home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
EDITORS
/
TEMPLED
/
TEMPED_SRC
/
Source
(
.txt
)
< prev
Wrap
RISC OS BBC BASIC V Source
|
1996-10-20
|
175KB
|
7,560 lines
Source code for !TemplEd
This application is FreeWare. (c) 1992-1995 Dick Alstein
Appl$="TemplEd"
Version$="1.32 (20-Oct-96)"
The following maximum values can be set to suit your needs
7MaxTemplates%=100 :
max number of user templates
AMaxIcons%=200 :
max number of icons in a user template
GMaxIndirSize%=8000 :
space for indirected data (only for loading)
*** main program and top-level procs ***
Quit%=
2PollMask%=(1<<0)+(1<<4)+(1<<5)+(1<<11)+(1<<12)
error(0)
Support%=3
"WimpExt_PrePoll"
/
"Wimp_Poll",PollMask%,Blk%
reason%
<
"WimpExt_Action",ThisTask%,Blk%,reason%
reason%
/
"Wimp_Poll",PollMask%,Blk%
reason%
reason%
,
"Wimp_GetPointerInfo",,PtrInfo%
1
(PtrInfo%!8>0)
Mbuttons_Released%
*
signal press of mouse button
Mbuttons_Released%=
N
click(PtrInfo%!0,PtrInfo%!4,PtrInfo%!8,PtrInfo%!12,PtrInfo%!16,0)
PtrInfo%!8=0
"9
Mbuttons_Released%)
(Drag_Type%=7)
#M
detected end of workarea-resize - set bottomright corner of
$9
work area to currently visible position
%# WinBlk%!0=Drag_Win%
&1
"Wimp_GetWindowState",,WinBlk%
': WinBlk%!52=WinBlk%!12-WinBlk%!4+WinBlk%!20
(= WinBlk%!48=-(WinBlk%!16-WinBlk%!8-WinBlk%!24)
)4 Drag_Win%=
redefinewindow(WinBlk%,
+" Mbuttons_Released%=
Drag_Type%=-1
-" TimedDrag_Enabled%=
/G
button still pressed - test if OK to start "timed drag"
0H
(PtrInfo%!0-ThisClickX%)+
(PtrInfo%!4-ThisClickY%)>16
1@ TimedDrag_Enabled%=
moved mouse since click
3$
TimedDrag_Enabled%
4I
-ThisClickTime%)>DragInterval%)
(PtrInfo%!16>=0)
5&
"Wimp_DragBox",-1
6D
starticondrag(PtrInfo%!8,PtrInfo%!12,PtrInfo%!16)
7& TimedDrag_Enabled%=
1 :
redraw(Blk%!0)
(Blk%!0=TemplW%)
?/ c%=(Blk%!12-Blk%!4)
TemplW_IconX%
c%<1
c%=1
A
TemplW_Cols%<>c%
TemplW_Cols%=c%
C!
redefinebrowser(
Blk%!0=TemplW%
Blk%!0=OptionsW%
H7
openpane(OptPaneW%,Blk%!28,Blk%!4,Blk%!16)
Blk%!28=OptPaneW%
K$
"Wimp_OpenWindow",,Blk%
Blk%!0=OptionsW%
M7
openpane(OptPaneW%,Blk%!28,Blk%!4,Blk%!16)
P$ no%=
whichtemplate(Blk%!0)
no%>=0
closetemplate(no%)
-1)
U"
closewindow(Blk%!0)
W.
"Wimp_GetPointerInfo",,PtrInfo%
XD
(Blk%!0=TemplW%)
(PtrInfo%!8=1)
MainFname$,".")>0)
YG
"Wimp_StartTask","Filer_OpenDir "+
dirname(MainFname$)
\<
6 :
click(Blk%!0,Blk%!4,Blk%!8,Blk%!12,Blk%!16,
]7
7 :
finishdrag(Blk%!0,Blk%!4,Blk%!8,Blk%!12)
^)
8 :
key(Blk%!0,Blk%!4,Blk%!24)
9 :
menuselect(Blk%)
`
17,18 :
receive(Blk%)
IcInfo_Active%
icinf_update
Quit%
font_loseall
support(0)
msg_exit
"Wimp_CloseDown"
p%,fn$,i%,mask%,flg%
ErrBlk% &100
"Wimp_Initialise",200,&4B534154,Appl$
OSversion%,ThisTask%
error(1)
ScrapBlk% &100 :
block to hold various temporary data
r'ApplDir$=
readvarval("TemplEd$Dir")
heap_init :
initialize heap
msg_init :
load Messages file
lower bounds for Max* variables
MaxTemplates%<4
MaxTemplates%=4
MaxIcons%<64
MaxIcons%=64
MaxIndirSize%<&1000
MaxIndirSize%=&1000
declaration of data blocks and arrays (variable size)
SelBlkSize%=4*MaxIcons%
{KSelBlk%=
heap_get(SelBlkSize%) :
to hold list of selected icons
|#SelBlk2%=
heap_get(SelBlkSize%)
}MTemplNames%=
heap_get(MaxTemplates%*28) :
to store template + icon name
~MTemplHandle%=
heap_get(4*MaxTemplates%) :
handles of the user templates
PPaneFlag%=
heap_get(MaxTemplates%) :
array for 'Pane' flags of templates
EMaxTemplateSize%=92+32*MaxIcons% :
max size for a template
MMaxTemplateSize%+=MaxIndirSize% :
extra space for indirected data
'WinBlk%=
heap_get(MaxTemplateSize%)
(FileIndexSize%=16+MaxTemplates%*24+4
NFileIndex%=
heap_get(FileIndexSize%) :
contains index of a template file
declaration of data blocks and arrays (fixed size)
IconBlk% 40
Blk% &100 :
for data returned by Wimp_Poll
PtrInfo% 20 :
to store pointer info
NumValidStr% 8 :
validation string for entering a number
$NumValidStr%="A0-9"
FpNumValidStr% 8 :
for entering a floating point number
$FpNumValidStr%="A0-9."
INrTemplates%=0 :
current number of user templates
KTemplatesOpen%=0 :
number of templates currently open
NSysIndirSize%=&1800 :
size of indirected data for system windows
IndirBlk% SysIndirSize%
@IndirEnd%=IndirBlk% :
pointer to first unused byte
HIndirFree%=SysIndirSize% :
remaining free space after IndirEnd%
IconText%(36) :
pointers to indirected text icons
IconTextWhdl%(36) :
corresponding window handles
IconTextIhdl%(36) :
corresponding icon handles
CselText%(12) :
pointers to text in colour-select boxes
CselTextWhdl%(12) :
corresponding window handles
CselTextIhdl%(12) :
corresponding icon handles
IcButton% 20*16 :
names of button types for icons
WinButton% 20*16 :
names of button types for windows
i%=0
3 $(IcButton%+20*i%)=
msg_lookup0("ICBT"+
(i%))
4 $(WinButton%+20*i%)=
msg_lookup0("WNBT"+
(i%))
WinEd_Col%(6) :
colours in the colour-select boxes
InverseColour%(15) :
to display text in colour boxes / colour menu
i%=0
0,1,2,3,9,12,14
InverseColour%(i%)=7
InverseColour%(i%)=0
DragBlk% 40 :
data block for starting drags
FontUsage%(256) :
counts number of icons that use a font
Fra% 256 :
font reference array for loading+saving templates
FontData% 64 :
buffer for reading font data
Mouse_Ptt% 16 :
pixel translation table for pointer changes
initialise global variables
/IcEd_Win%=-1000 :
invalid values
IcEd_Icon%=-1000
WinEd_Win%=-1
5Mbuttons_Released%=
to debounce mouse clicks
?ThisClickTime%=
:
to store data of last mouse click
ThisClickX%=-1000
ThisClickY%=-1000
ThisClickButton%=0
ITimedDrag_Enabled%=
can I start "timed drag" from current click?
LDragInterval%=50 :
interval after which "timed drag" can start
JDclickInterval%=50 :
max time between clicks of a double-click
HNextIconNr%=0 :
for semi-automatic renumbering of icons
:LastMenu%=-1 :
handle of last menu shown
FLastMenu_Win%=-31 :
window above which last menu was made
4LastMenu_Icon%=-1 :
icon handle of same
;MainFname$="Templates" :
save all templates as ....
@SelFname$="Selection" :
save template selection as ....
@ExportTname$="TemplText" :
save exported templates as ....
AExportIname$="IconNames" :
save exported icon names as ....
HSavingSelection%=
:
was last save dialogue to save a selection?
FExporting%=
:
was last save dialogue to export as text?
BQuitAfterSave%=
:
quit program after current save proc?
GNewFname$="" :
name of new template file to be loaded
BChangesMade%=
:
have current templates been modified?
KUserSprites%=1 :
sprites in user templates from Wimp area (at first)
BSpriteFname$="" :
name of sprite file if not using Wimp area
CDrag_Type%=-1 :
type of current drag operation (-1 => none)
LSupport%=0 :
is in setup, but must exist before loading templates
create icon on icon bar
IconBlk%!0=-1
IconBlk%!4=0 : IconBlk%!8=0
#IconBlk%!12=68 : IconBlk%!16=68
IconBlk%!20=&7000301A
$(IconBlk%+24)="!templed"
"Wimp_CreateIcon",,IconBlk%
BarIcon%
load system sprites
4SysSprites%=
loadspritefile(ApplDir$+".Sprites")
initialise font reference arrays
i%=0
Fra%?i%=0
load system templates and set pointers to indirected data
"Wimp_OpenTemplate",,ApplDir$+".Templates"
?InfoW%=
loadtemplate("Info",WinBlk%,IndirEnd%,IndirFree%,1)
$$(WinBlk%!(92+3*32+20))=Version$
OTemplW%=
loadtemplate("Templates",WinBlk%,IndirEnd%,IndirFree%,SysSprites%)
DTemplTbar%=WinBlk%!76 :
pointer to text in title bar
$(TemplTbar%)=MainFname$
i%=WinBlk%+92
ITemplW_IconX%=i%!8-i%!0 + 8 :
size of an icon in browser window
TemplW_IconY%=i%!12-i%!4 + 8
2TemplW_IconFlags%=i%!16 :
icon flags
DTemplW_Cols%=(WinBlk%!12-WinBlk%!4)
TemplW_IconX% :
#columns
TemplW_Cols%<1
TemplW_Cols%=1
ScrapBlk%!0=TemplW%
ScrapBlk%!4=0
"Wimp_DeleteIcon",,ScrapBlk% :
icon is only used to set size
MIcEdW%=
loadtemplate("IconEdit",WinBlk%,IndirEnd%,IndirFree%,SysSprites%)
IcEdTbar%=WinBlk%!76
linkicontext(0,WinBlk%,23) :
text in a text icon
linkicontext(1,WinBlk%,24) :
name of a sprite
linkicontext(2,WinBlk%,25) :
validation string
linkicontext(3,WinBlk%,26) :
max size
linkicontext(4,WinBlk%,28) :
icon button type
linkicontext(5,WinBlk%,31) :
linkicontext(19,WinBlk%,45) :
font name
linkicontext(20,WinBlk%,48) :
font x size
linkicontext(21,WinBlk%,51) :
font y size
linkcseltext(0,WinBlk%,34) :
foreground colour
linkcseltext(1,WinBlk%,37) :
background colour
PWinEdW%=
loadtemplate("WindowEdit",WinBlk%,IndirEnd%,IndirFree%,SysSprites%)
WinEdTbar%=WinBlk%!76
linkicontext(6,WinBlk%,23) :
window button type
linkcseltext(2,WinBlk%,27) :
title foreground colour
linkcseltext(3,WinBlk%,31) :
title background colour
linkcseltext(4,WinBlk%,35) :
work area foreground colour
linkcseltext(5,WinBlk%,39) :
work area background colour
linkcseltext(6,WinBlk%,43) :
scrollbar inner colour
linkcseltext(7,WinBlk%,47) :
scrollbar outer colour
linkcseltext(8,WinBlk%,51) :
input focus colour
DDefW%=
loadtemplate("DefaultWin",WinBlk%,IndirEnd%,IndirFree%,1)
BSaveW%=
loadtemplate("SaveBox",WinBlk%,IndirEnd%,IndirFree%,1)
GFileName%=WinBlk%!(92+1*32+20) :
pointer to file name in savebox
>SaveFileIcon%=WinBlk%!(92+2*32+20) :
draggable file-icon
EIcInfoW%=
loadtemplate("IconInfo",WinBlk%,IndirEnd%,IndirFree%,1)
&IcInfo_Width%=WinBlk%!12-WinBlk%!4
linkicontext(7,WinBlk%,6) :
template name
linkicontext(8,WinBlk%,7) :
icon number
linkicontext(9,WinBlk%,9) :
minimum x coordinate
linkicontext(26,WinBlk%,10) :
maximum x coordinate
linkicontext(10,WinBlk%,11) :
minimum y coordinate
linkicontext(27,WinBlk%,8) :
maximum y coordinate
linkicontext(11,WinBlk%,12) :
icon size
linkicontext(24,WinBlk%,13) :
pointer position
CExportW%=
loadtemplate("Export",WinBlk%,IndirEnd%,IndirFree%,1)
EExportName%=WinBlk%!(92+1*32+20) :
pointer to export-file name
@ExportFileIcon%=WinBlk%!(92+2*32+20) :
draggable file-icon
MWorkW%=
loadtemplate("WorkArea",WinBlk%,IndirEnd%,IndirFree%,SysSprites%)
linkicontext(12,WinBlk%,10) :
top left X coord
linkicontext(13,WinBlk%,13) :
top left Y coord
linkicontext(14,WinBlk%,16) :
work area X size
linkicontext(15,WinBlk%,19) :
work area Y size
linkicontext(16,WinBlk%,22) :
min X size
linkicontext(17,WinBlk%,25) :
min Y size
KAlignW%=
loadtemplate("Align",WinBlk%,IndirEnd%,IndirFree%,SysSprites%)
selecticon(AlignW%,2,1) :
set align-left on
selecticon(AlignW%,8,1) :
move icons
OOptionsW%=
loadtemplate("Options",WinBlk%,IndirEnd%,IndirFree%,SysSprites%)
OOptPaneW%=
loadtemplate("OptPane",WinBlk%,IndirEnd%,IndirFree%,SysSprites%)
linkicontext(28,WinBlk%,19) :
iconsize grid X size
linkicontext(29,WinBlk%,23) :
iconsize grid Y size
linkicontext(30,WinBlk%,28) :
iconpos grid X size
linkicontext(31,WinBlk%,32) :
iconpos grid Y size
NSpaceW%=
loadtemplate("Spaceout",WinBlk%,IndirEnd%,IndirFree%,SysSprites%)
selecticon(SpaceW%,3,1) :
set space-vertically on
selecticon(SpaceW%,4,1) :
set to fixed spacing
linkicontext(18,WinBlk%,6) :
space between icons
SpaceOut_Space%=4
seticontext(18,
(SpaceOut_Space%))
space_shadeicons
'KFrameW%=
loadtemplate("Frame",WinBlk%,IndirEnd%,IndirFree%,SysSprites%)
linkicontext(32,WinBlk%,7) :
frame icon #
linkicontext(33,WinBlk%,11) :
space around icons
linkicontext(34,WinBlk%,17) :
label icon #
linkicontext(35,WinBlk%,22) :
left space for label
selecticon(FrameW%,6,1) :
use icon for frame
selecticon(FrameW%,15,1) :
no label
selecticon(FrameW%,21,1) :
left-spaced label
Frame_IconNo%=0
Frame_Space%=24
Frame_LabelNo%=0
Frame_LeftSpace%=32
seticontext(33,
(Frame_Space%))
seticontext(35,
(Frame_LeftSpace%))
5JStatW%=
loadtemplate("Stats",WinBlk%,IndirEnd%,IndirFree%,SysSprites%)
64Stat_Colours%=(WinBlk%!(92+5*32+16))
&FF000000
7EPaletteW%=
loadtemplate("Palette",WinBlk%,IndirEnd%,IndirFree%,1)
8CDialW%=
loadtemplate("Dialogue",WinBlk%,IndirEnd%,IndirFree%,1)
Dial_Msg%=WinBlk%!(92+20)
:IDial_Button1%=WinBlk%!(92+1*32+20) :
pointer to text in left button
;KDial_Button2%=WinBlk%!(92+2*32+20) :
pointer to text in middle button
<JDial_Button3%=WinBlk%!(92+3*32+20) :
pointer to text in right button
store colours and border flag of buttons
>!mask%=(1<<2)+(1<<5)+(&FF<<24)
?3Dial_ButtonCol1%=(WinBlk%!(92+1*32+16))
mask%
@3Dial_ButtonCol2%=(WinBlk%!(92+2*32+16))
mask%
A3Dial_ButtonCol3%=(WinBlk%!(92+3*32+16))
mask%
"Wimp_CloseTemplate"
initialise font usage
i%=0
Fra%?i%>0
F= FontUsage%(i%)=1 :
font is used by system templates
FontUsage%(i%)=0
setup_load
readscreenvars
selecticon(OptPaneW%,13,IcInfo_Active%)
selecticon(OptPaneW%,11,DuplNames%)
selecticon(OptPaneW%,12,Hatch%)
selecticon(OptPaneW%,16,Grid_SizeLock%)
seticontext(28,
(Grid_SizeX%))
seticontext(29,
(Grid_SizeY%))
selecticon(OptPaneW%,25,Grid_PosLock%)
seticontext(30,
(Grid_PosX%))
seticontext(31,
(Grid_PosY%))
selecticon(OptPaneW%,14,Save_Unselected%)
selecticon(OptPaneW%,15,DeleteOutside%)
selecticon(OptPaneW%,8,TrapDclick%)
selecticon(OptPaneW%,35,IgnoreDeskFont%)
support(Setup_Support%)
selecticon(StatW%,1,Stats_Decimal%)
selecticon(StatW%,2,
Stats_Decimal%)
preparemenus
"OS_ReadModeVariable",27,0
;flg% :
test if hires modes available
(flg%
2)=0
SprSuffix$="22"
SprSuffix$=""
calculate height of title bar
WinBlk%!0=DefW%
"Wimp_GetWindowState",,WinBlk%
WinBlk%!28=-2
"Wimp_OpenWindow",,WinBlk%
i%=WinBlk%!12
"Wimp_GetWindowOutline",,WinBlk%
TBarHeight%=WinBlk%!12-i%
"Wimp_CloseWindow",,WinBlk%
get filename that was given as argument with command
"OS_GetEnv"
fn$,"-quit")
p%>0
34,p%+
("-quit"))
p%>0
34,p%+1)
p%>0
fn$=
fn$,p%+1)
p%=
fn$," ")
p%=0
(fn$)>0
xA
templ_loadfile(fn$,1) :
found filename - load the file
setmainfname(fn$)
setextent
key(window%,icon%,key%)
i%,waslast%,dx%,dy%,no%,help$,xmin%,ymin%,xmax%,ymax%,xstep%,ystep%
(key%=27)
(Drag_Type%<>-1)
abortdrag
window%
IcEdW%
key%
0
&18E,&18A,13 :
down, tab, return
icon%>0
i%=icon%
waslast%=
i%=26
i%=23
5 waslast%=
caret went "round"
i%+=1
9
iconshaded(IcEdW%,i%))
(i%=icon%)
(
waslast%
(key%=13)
)
selecticon(IcEdW%,9,1)
#
iced_readwin(-1)
)
selecticon(IcEdW%,9,0)
i%=icon%
$
setcaret(IcEdW%,i%)
)
&18F,&19A :
up, shift+tab
icon%>0
i%=icon%
i%=23
i%=26
i%-=1
9
iconshaded(IcEdW%,i%))
(i%=icon%)
$
setcaret(IcEdW%,i%)
&181 :
0
"Wimp_GetPointerInfo",,PtrInfo%
$
PtrInfo%!12=IcEdW%
help$=""
PtrInfo%!16
6
14 : help$="Indirected"
6
3,25 : help$="Validation"
3
4,26 : help$="Maxsize"
2
15 : help$="Border"
2
16 : help$="Filled"
4
17 : help$="Hcentred"
4
18 : help$="Vcentred"
6
19 : help$="Rjustified"
5
20 : help$="Needshelp"
7
21 : help$="Allowadjust"
4
22 : help$="Halfsize"
6
5,27,28,29 : help$="Buttontype"
/
6,30,31,32 : help$="ESG"
2
39 : help$="Shaded"
1
7,33,34,35 : help$="Fgcol"
1
8,36,37,38 : help$="Bgcol"
0
41 : help$="Font"
1
1 : help$="Flags"
help$<>""
5
askhelp("TemplEd.IconInfo_"+help$)
&182 :
%
selecticon(IcEdW%,9,1)
iced_readwin(-1)
%
selecticon(IcEdW%,9,0)
&183 :
&
selecticon(IcEdW%,10,1)
iced_readwin(-1)
&
selecticon(IcEdW%,10,0)
"
closewindow(IcEdW%)
%
setcaret(IcEd_Win%,-1)
!
&184,27 :
F4, Esc
&
selecticon(IcEdW%,11,1)
"
closewindow(IcEdW%)
&
selecticon(IcEdW%,11,0)
%
setcaret(IcEd_Win%,-1)
'
"Wimp_ProcessKey",key%
WinEdW%
key%
&181
0
"Wimp_GetPointerInfo",,PtrInfo%
%
PtrInfo%!12=WinEdW%
help$=""
PtrInfo%!16
4
4 : help$="Moveable"
7
5 : help$="Auto-redraw"
3
6 : help$="Hotkeys"
0
7 : help$="Pane"
4
8 : help$="Nobounds"
0
9 : help$="GCOL"
6
10 : help$="Backwindow"
6
1,21,22,23,24 : help$="Buttontype"
5
20 : help$="Newformat"
4
57 : help$="OnScreen"
2
11,58,59,60 : help$="Scroll"
4
12,61,62,63 : help$="NoExtent"
help$<>""
4
askhelp("TemplEd.WinInfo_"+help$)
&182,13
'
selecticon(WinEdW%,53,1)
wined_readwin
'
selecticon(WinEdW%,53,0)
&183
'
selecticon(WinEdW%,54,1)
wined_readwin
'
selecticon(WinEdW%,54,0)
#
closewindow(WinEdW%)
&
setcaret(WinEd_Win%,-1)
&184,27
'
selecticon(WinEdW%,55,1)
#
closewindow(WinEdW%)
'
selecticon(WinEdW%,55,0)
&
setcaret(WinEd_Win%,-1)
'
"Wimp_ProcessKey",key%
SaveW%
key%
%
selecticon(SaveW%,0,1)
Exporting%
.
exporttemplates($(FileName%))
$
SavingSelection%
( SelFname$=$(FileName%)
+
savetemplates(SelFname$)
-
setmainfname($(FileName%))
,
savetemplates(MainFname$)
%
selecticon(SaveW%,0,0)
&
"Wimp_CreateMenu",,-1
'
"Wimp_ProcessKey",key%
ExportW%
key%
'
selecticon(ExportW%,0,1)
/
export_savenames($(ExportName%))
'
selecticon(ExportW%,0,0)
&
"Wimp_CreateMenu",,-1
'
"Wimp_ProcessKey",key%
WorkW%
key%
&18E,&18A,13
icon%=25
key%=13
#*
selecticon(WorkW%,30,1)
setworkarea
%*
selecticon(WorkW%,30,0)
&*
"Wimp_CreateMenu",,-1
(&
setcaret(WorkW%,10)
+)
setcaret(WorkW%,icon%+3)
&18F,&19A
icon%=10
/$
setcaret(WorkW%,25)
1)
setcaret(WorkW%,icon%-3)
4&
"Wimp_CreateMenu",,-1
6'
"Wimp_ProcessKey",key%
SpaceW%
key%=13
:$
selecticon(SpaceW%,9,1)
;&
spaceicons(LastMenu_Win%)
<$
selecticon(SpaceW%,9,0)
=$
"Wimp_CreateMenu",,-1
?%
"Wimp_ProcessKey",key%
FrameW%
key%=13
C$
selecticon(FrameW%,3,1)
D$
"Wimp_CreateMenu",,-1
E&
frameicons(LastMenu_Win%)
F$
selecticon(FrameW%,3,0)
H%
"Wimp_ProcessKey",key%
J
Drag_Type%
0,1,5,6,7
dx%=0
dy%=0
key%
P(
&18C : dx%=-PixToOS_X%
Q'
&18D : dx%=PixToOS_X%
R(
&18E : dy%=-PixToOS_Y%
S'
&18F : dy%=PixToOS_Y%
T*
&19C : dx%=-4*PixToOS_X%
U)
&19D : dx%=4*PixToOS_X%
V*
&19E : dy%=-4*PixToOS_Y%
W)
&19F : dy%=4*PixToOS_Y%
X-
"Wimp_ProcessKey",key%
Z0
"Wimp_GetPointerInfo",,PtrInfo%
[4
(PtrInfo%!0)+dx%,(PtrInfo%!4)+dy%
]) no%=
whichtemplate(window%)
no%>=0
key%
`@
1 :
sel_all(window%) :
dummy%=-1
cC
copyiconsel(window%,dummy%,0) :
dummy%=-1
fC
copyiconsel(window%,dummy%,2) :
g@
5 :
iced_start(window%,-1) :
iC
sel_get(window%) :
j&
NrSelected%>=2
k$
frame_fillwin
l<
createwinmenu(window%,FrameW%,-80,80)
oC
sel_get(window%) :
p&
NrSelected%>=2
q<
createwinmenu(window%,AlignW%,-80,80)
tC
sel_get(window%) :
u&
NrSelected%>=2
v<
createwinmenu(window%,SpaceW%,-80,80)
dummy%=-1
zC
copyiconsel(window%,dummy%,3) :
{D
17,&1A2 :
closetemplate(no%) :
^Q,^F2
dummy%=-1
~C
copyiconsel(window%,dummy%,4) :
@
20 :
iced_start(window%,-4) :
dummy%=-1
C
copyiconsel(window%,dummy%,1) :
@
23 :
wined_fillwin(window%) :
@
24 :
deleteiconsel(window%,-1) :
@
26 :
sel_clear(window%,-1) :
;
&18C,&18D,&18E,&18F,&19C,&19D,&19E,&19F
%
sel_get(window%)
%
NrSelected%>0
?
sel_box(window%,xmin%,ymin%,xmax%,ymax%)
'
Grid_PosLock%
) xstep%=Grid_PosX%
) ystep%=Grid_PosY%
*
Grid_SizeLock%
, xstep%=Grid_SizeX%
, ystep%=Grid_SizeY%
+ xstep%=PixToOS_X%
+ ystep%=PixToOS_Y%
&
(key%
&F)
*
&C : dx%=-xstep%
)
&D : dx%=xstep%
*
&E : dy%=-ystep%
)
&F : dy%=ystep%
$
key%
&10
! dx%=dx%*4
! dy%=dy%*4
xmin%+=dx%
xmax%+=dx%
ymin%+=dy%
ymax%+=dy%
M
moveresize(window%,-1,window%,xmin%,ymin%,xmax%,ymax%)
2
:
"Wimp_ProcessKey",key%
)
"Wimp_ProcessKey",key%
loadtemplate(name$,buf%,
indir%,
free%,spptr%)
oldindir%,handle%
"Wimp_CloseTemplate" :
error(1)
oldindir%=indir%
name$=name$+
"Wimp_LoadTemplate",,buf%+4,indir%,indir%+free%,Fra%,name$,0
,,indir%
free%-=(indir%-oldindir%)
buf%!68=spptr%
buf%!88>0
i%=0
buf%!88
f%=buf%!(92+i%*32+16)
(f%
&103)=&102
# buf%!(92+i%*32+24)=spptr%
"Wimp_CreateWindow",,buf%+4
handle%
buf%!0=handle%
=handle%
menuselect(selection%)
adjust%,selinfo%,itemnr%,item%,item$,parentitem%,parentitem$
cmd$,i%,j%,minx%,miny%,size,dir%
"MenuUtil_Decode",LastMenu%,selection%
,adjust%,selinfo%
itemnr%=selinfo%!0
item%=selinfo%!8
item$=
str(selinfo%!12)
parentitem%=selinfo%!24
parentitem%<>0
parentitem$=
str(selinfo%!28)
LastMenu%
MainMenu%
item%
item_help%
,
modulepresent("StrongHelp")
C
"Wimp_StartTask","Filer_Run <TemplEd$Dir>.TemplEd"
dialogue(5,"")
item_options%
$
openwindow(OptionsW%,2)
item_stats%
stat_fillwin
-
item_customsprites%,item_sprview%
UserSprites%<>1
& cmd$="Run "+SpriteFname$
4
OSversion%>=300
cmd$="Filer_"+cmd$
cmd$
item_sprreload%
*
loadusersprites(SpriteFname$)
item_sprreset%
loadusersprites("")
item_quit%
ChangesMade%
dialogue(0,"")
prequit
TemplMenu%
item%
item_templname%
parentitem%
!
item_createtempl%
(item$)>0
! WinBlk%!0=DefW%
2
"Wimp_GetWindowInfo",,WinBlk%
J $(WinBlk%+76)=item$ :
title bar equal to template name
WinBlk%!88=0
-
templ_add(item$,WinBlk%,1)
/
opentemplate(NrTemplates%-1)
setchanged(
!
item_renametempl%
(item$)>0
j%=0
0
check if name already exists
F
(j%<NrTemplates%)
($(TemplNames%+28*j%)<>item$)
j%+=1
4
(j%=NrTemplates%)
DuplNames%
i%=SelBlk%!0
. $(TemplNames%+28*i%)=item$
& IconBlk%!0=TemplW%
! IconBlk%!4=i%
4
"Wimp_GetIconState",,IconBlk%
O IconBlk%!16=(IconBlk%!8)+(TemplW_IconX%-8)-16*(11-
(item$))
= dummy%=
redefineicon(TemplW%,i%,IconBlk%)
"
setchanged(
3
complain(
msg_lookup0("TAEX"))
item_copytempl%
(item$)>0
#
sel_get(TemplW%)
8 WinBlk%!0=TemplHandle%!(4*(SelBlk%!0))
2
"Wimp_GetWindowInfo",,WinBlk%
0
PaneFlag%?(SelBlk%!(4*i%))
G WinBlk%!32=WinBlk%!32
(1<<5) :
copy 'Pane' flag
5
iconrealloc(WinBlk%+60,WinBlk%+76)
"
WinBlk%!88>0
)
i%=0
WinBlk%!88-1
K
iconrealloc(WinBlk%+92+32*i%+16,WinBlk%+92+32*i%+20)
-
templ_add(item$,WinBlk%,1)
/
opentemplate(NrTemplates%-1)
setchanged(
item_opentempl%
sel_get(TemplW%)
#'
i%=NrSelected%-1
$+
opentemplate(SelBlk%!(4*i%))
item_closetempl%
sel_get(TemplW%)
('
i%=NrSelected%-1
),
closetemplate(SelBlk%!(4*i%))
item_deletetempl%
"Hourglass_On"
sel_get(TemplW%)
.'
i%=NrSelected%-1
/+
templ_delete(SelBlk%!(4*i%))
1"
sel_clear(TemplW%,-1)
2! LastMenu_Win%=TemplW%
LastMenu_Icon%=-1
"Hourglass_Off"
item_selalltempl%
sel_all(TemplW%)
7! TemplMenu_Deselect%=
item_clearseltempl%
9"
sel_clear(TemplW%,-1)
:! TemplMenu_Deselect%=
item_deleteall%
ChangesMade%
dialogue(1,"")
templ_deleteall
@# LastMenu_Win%=TemplW%
LastMenu_Icon%=-1
item_sorttempl%
D"
sel_clear(TemplW%,-1)
templ_sort
redefinebrowser(
G! LastMenu_Win%=TemplW%
LastMenu_Icon%=-1
item_save%
SavingSelection%=
K&
savetemplates(MainFname$)
L
M6
TemplMenu_Deselect%
sel_clear(TemplW%,-1)
UserMenu%
item%
PE
item_copyicon%,item_up%,item_down%,item_left%,item_right%
item%
R'
item_copyicon% : dir%=0
S'
item_up% : dir%=1
T'
item_down% : dir%=2
U'
item_left% : dir%=3
V'
item_right% : dir%=4
X;
copyiconsel(LastMenu_Win%,LastMenu_Icon%,dir%)
Y+
item_iconnr%,item_renumbericon%
Z7
item%=item_iconnr%
NextIconNr%=
(item$)
[#
sel_get(LastMenu_Win%)
NrSelected%
^;
renumbericon(LastMenu_Win%,LastMenu_Icon%)
_* LastMenu_Icon%=NextIconNr%
NextIconNr%+=1
b6
renumbericon(LastMenu_Win%,SelBlk%!0)
d/
renumbericonsel(LastMenu_Win%)
item_deleteicon%
g8
deleteiconsel(LastMenu_Win%,LastMenu_Icon%)
item_editicon%
i5
iced_start(LastMenu_Win%,LastMenu_Icon%)
item_minsize%
k<
minimizeiconsel(LastMenu_Win%,LastMenu_Icon%,0)
item_centericon%
m:
centericonsel(LastMenu_Win%,LastMenu_Icon%,0)
item_samesize%
o<
samesizeiconsel(LastMenu_Win%,LastMenu_Icon%,0)
p,
item_both%,item_xdim%,item_ydim%
parentitem%
item_minsize%
sF
minimizeiconsel(LastMenu_Win%,LastMenu_Icon%,itemnr%)
t
item_centericon%
uD
centericonsel(LastMenu_Win%,LastMenu_Icon%,itemnr%)
item_samesize%
wF
samesizeiconsel(LastMenu_Win%,LastMenu_Icon%,itemnr%)
item_selallicons%
z#
sel_all(LastMenu_Win%)
item_clearselicons%
|(
sel_clear(LastMenu_Win%,-1)
item_editwindow%
~)
wined_fillwin(LastMenu_Win%)
item_edittitle%
)
iced_start(LastMenu_Win%,-4)
item_tidy1%
5 LastMenu_Win%=
tidyicons(LastMenu_Win%,1)
item_tidy2%
5 LastMenu_Win%=
tidyicons(LastMenu_Win%,2)
item_tidy3%
5 LastMenu_Win%=
tidyicons(LastMenu_Win%,3)
item_tidy4%
5 LastMenu_Win%=
tidyicons(LastMenu_Win%,4)
item_tidy5%
5 LastMenu_Win%=
tidyicons(LastMenu_Win%,5)
item_centerwin%
(
openwindow(LastMenu_Win%,1)
item_wimparea%
2
window_setspritearea(LastMenu_Win%,1)
item_customarea%
=
window_setspritearea(LastMenu_Win%,UserSprites%)
item_closewin%
9
closetemplate(
whichtemplate(LastMenu_Win%))
item_createicon%
$
openwindow(PaletteW%,0)
IcButtonMenu%
IcEd_Button%=itemnr%
4
seticontext(4,$(IcButton%+20*IcEd_Button%))
WinButtonMenu%
WinEd_Button%=itemnr%
6
seticontext(6,$(WinButton%+20*WinEd_Button%))
EsgMenu%
IcEd_Esg%=
item$,2))
$
seticontext(5,
(IcEd_Esg%))
ColourMenu%
item$="None"
j%=255
j%=
(item$)
LastMenu_Win%
IcEdW%
LastMenu_Icon%
IcEd_Fgcol%=j%
#
setcolourbox(0,j%)
IcEd_Bgcol%=j%
#
setcolourbox(1,j%)
WinEdW%
& i%=(LastMenu_Icon%-27)
WinEd_Col%(i%)=j%
"
setcolourbox(2+i%,j%)
FontMenu%
(parentitem$)>0
item$="(Regular)"
" IcEd_Font$=parentitem$
, IcEd_Font$=parentitem$+"."+item$
%
seticontext(19,IcEd_Font$)
FontSizemenu%
size=
(item$)
size>0
LastMenu_Icon%=48
IcEd_Xsize=size
.
seticontext(20,
(IcEd_Xsize),4))
(
iconselected(IcEdW%,53)
# IcEd_Ysize=IcEd_Xsize
0
seticontext(21,
(IcEd_Ysize),4))
IcEd_Ysize=size
.
seticontext(21,
(IcEd_Ysize),4))
Updatemenu%
item%
1
item_updbt% :
iced_readwin(&F<<12)
2
item_updesg% :
iced_readwin(&1F<<16)
:
item_updfg% :
iced_readwin((&F<<24)+(1<<6))
:
item_updbg% :
iced_readwin((&F<<28)+(1<<6))
;
item_updfont% :
iced_readwin((&FF<<24)+(1<<6))
7
item_updrest% :
iced_readwin(&EFC+(1<<22))
/
item_updbo%: :
iced_readwin(1<<2)
/
item_updfi%: :
iced_readwin(1<<5)
/
item_updhc%: :
iced_readwin(1<<3)
/
item_updvc%: :
iced_readwin(1<<4)
/
item_updrj%: :
iced_readwin(1<<9)
/
item_updnh%: :
iced_readwin(1<<7)
0
item_updaa%: :
iced_readwin(1<<10)
0
item_updhs%: :
iced_readwin(1<<11)
0
item_updsh%: :
iced_readwin(1<<22)
LastMenu_Icon%=10
closewindow(IcEdW%)
!
setcaret(IcEd_Win%,-1)
adjust%=
adjust%
createmenu(LastMenu_X%,LastMenu_Y%,LastMenu_Win%,LastMenu_Icon%)
LastMenu%=-1
editaction(xpos%,ypos%,button%,window%,icon%,no%)
key%,dclick%
key%=0
dclick%=
-1)
key%+=1 :
bit 0 -> Shift key
-2)
key%+=2 :
bit 1 -> Ctrl key
-3)
key%+=4 :
bit 2 -> Alt key
+TimedDrag_Enabled%=(key%=0)
(icon%>=-1)
button%>256
@ button%=button%>>8 :
clicked on icon with button type 10
key%
0 :
mouse button, no key
button%>0
4 dclick%=(
-ThisClickTime%)<DclickInterval%
A dclick%=dclick%
(ThisClickButton%=button%)
(no%>=0)
J dclick%=dclick%
(ThisClickX%-xpos%)+
(ThisClickY%-ypos%))<32
ThisClickTime%=
ThisClickX%=xpos%
ThisClickY%=ypos%
" ThisClickButton%=button%
button%
icon%
7
dclick%
TrapDclick%
(button%=4)
,
iced_start(window%,icon%)
4
button%=4
sel_clear(window%,-1)
7
dclick%
TrapDclick%
(button%=4)
)
wined_fillwin(window%)
&
dragselect(button%)
2
no%>=0
setcaret(window%,-1)
icon%>=0
button%=1
-
toggle "selected" state
' ScrapBlk%!0=window%
% ScrapBlk%!4=icon%
5
"Wimp_GetIconState",,ScrapBlk%
2
((ScrapBlk%!24)>>12)
M
4,9 :
selecting useless for these button types
;
5,7,8,11 :
selecting done by wimp
<
seticonstate(window%,icon%,1<<21,0)
(
"exclusive" select
-
sel_clear(window%,icon%)
6
iconselected(window%,icon%)
2
selecticon(window%,icon%,1)
#9
dclick%
TrapDclick%
(button%=4)
$.
iced_start(window%,icon%)
&(
dragselect(button%)
'4
no%>=0
setcaret(window%,-1)
+
1 :
shift + mouse button
button%
/,
no%>=0
setcaret(window%,-1)
0&
(no%>=0)
(button%=4)
13
starticondrag(button%,window%,icon%)
41
no%>=0
iced_start(window%,icon%)
5
2 :
ctrl + mouse button
button%
no%>=0
:#
setcaret(window%,-1)
;)
startwindowresize(window%)
no%>=0
icon%=-4
@*
iced_start(window%,icon%)
B'
wined_fillwin(window%)
no%>=0
G#
setcaret(window%,-1)
H'
startwindowmove(window%)
J
4 :
alt + mouse button
button%
N%
(icon%>=0)
(no%>=0)
O*
renumbericon(window%,icon%)
P.
NextIconNr%>0
NextIconNr%-=1
S%
(icon%>=0)
(no%>=0)
T*
renumbericon(window%,icon%)
NextIconNr%+=1
W
6 :
alt + ctrl + mouse button
button%
[6
(no%>=0)
startworkarearesize(window%)
\
(button%>0)
Support%
`%
1 :
support Interface
invert icon
b! ScrapBlk%!8=button%
c" ScrapBlk%!12=window%
d ScrapBlk%!16=icon%
e-
"Wimp_BorderIcon",,ScrapBlk%
back to normal
ScrapBlk%!8=0
h" ScrapBlk%!12=window%
i ScrapBlk%!16=icon%
j-
"Wimp_BorderIcon",,ScrapBlk%
2 :
support AEH
l! ScrapBlk%!8=button%
m" ScrapBlk%!12=window%
n ScrapBlk%!16=icon%
o,
"AEH_RedrawIcon",,ScrapBlk%
p$
"AEH_ReleaseIcon",0
q#
3 :
support WimpExt
r3
"WimpExt_SlabIcon",,,window%,icon%
t
click(xpos%,ypos%,button%,window%,icon%,wimpclick%)
no%,key%
z"Mbuttons_Released%=(button%=0)
TimedDrag_Enabled%=
whichtemplate(window%)
button%=2
"steal" clicks with Menu if Shift, Ctrl or Alt pressed
"OS_Byte",121,0
,key%
key%>=3
=
wimpclick%
createmenu(xpos%,ypos%,window%,icon%)
F
no%<>-1
editaction(xpos%,ypos%,button%,window%,icon%,no%)
no%<>-1
:
editaction(xpos%,ypos%,button%,window%,icon%,no%)
D
wimpclick%
iconclick(xpos%,ypos%,button%,window%,icon%)
iconclick(xpos%,ypos%,button%,window%,icon%)
select%,menu%,adjust%,i%,j%,xsize%,ysize%,up%,lo%
select%=(button%=4)
menu%=(button%=2)
adjust%=(button%=1)
window%
select%
redefinebrowser(
openwindow(TemplW%,3)
4
IcInfo_Active%
openwindow(IcInfoW%,4)
IcEdW%
6
iced_click(xpos%,ypos%,select%,adjust%,icon%)
WinEdW%
7
wined_click(xpos%,ypos%,select%,adjust%,icon%)
StatW%
!
(icon%=1)
(icon%=2)
" Stats_Decimal%=(icon%=1)
%
selecticon(StatW%,icon%,1)
stat_fillwin
TemplW%
,
(select%
adjust%)
(icon%>=0)
, ScrapBlk%!0=TemplHandle%!(4*icon%)
-
"Wimp_GetWindowState",,ScrapBlk%
$
ScrapBlk%!32
(1<<16)
!
closetemplate(icon%)
opentemplate(icon%)
&
selecticon(TemplW%,icon%,0)
select%
(icon%=-1)
sel_clear(TemplW%,-1)
'
(button%=16)
(button%=64)
!
dragselect(button%>>4)
SaveW%
icon%
Exporting%
,
exporttemplates($(FileName%))
"
SavingSelection%
& SelFname$=$(FileName%)
)
savetemplates(SelFname$)
+
setmainfname($(FileName%))
*
savetemplates(MainFname$)
$
"Wimp_CreateMenu",,-1
(button%>>4)
$
startsavedrag(SaveW%)
ExportW%
icon%
-
export_savenames($(ExportName%))
(button%>>4)
&
startsavedrag(ExportW%)
3,4,5
$
export_settype(icon%-3)
AlignW%
icon%
&
alignicons(LastMenu_Win%)
4
adjust%)
"Wimp_CreateMenu",,-1
align_shadeicons
SpaceW%
icon%
/ SpaceOut_Space%=
($(IconText%(18)))
% up%=(adjust%
(icon%=7))
:
changevar(SpaceOut_Space%,4,up%,-512,512)
1
seticontext(18,
(SpaceOut_Space%))
"
setcaret(SpaceW%,6)
space_shadeicons
(
icon%=8
setcaret(-1,-1)
&
spaceicons(LastMenu_Win%)
4
adjust%)
"Wimp_CreateMenu",,-1
FrameW%
icon%
- Frame_IconNo%=
($(IconText%(32)))
% up%=(adjust%
(icon%=9))
5
changevar(Frame_IconNo%,1,up%,0,512)
/
seticontext(32,
(Frame_IconNo%))
"
setcaret(FrameW%,7)
12,13
, Frame_Space%=
($(IconText%(33)))
& up%=(adjust%
(icon%=13))
4
changevar(Frame_Space%,4,up%,0,512)
.
seticontext(33,
(Frame_Space%))
#
setcaret(FrameW%,11)
18,19
. Frame_LabelNo%=
($(IconText%(34)))
& up%=(adjust%
(icon%=17))
6
changevar(Frame_LabelNo%,1,up%,0,512)
0
seticontext(34,
(Frame_LabelNo%))
#
setcaret(FrameW%,17)
23,24
0 Frame_LeftSpace%=
($(IconText%(35)))
& up%=(adjust%
(icon%=24))
8
changevar(Frame_LeftSpace%,4,up%,0,512)
2
seticontext(35,
(Frame_LeftSpace%))
#
setcaret(FrameW%,22)
4
adjust%)
"Wimp_CreateMenu",,-1
&
frameicons(LastMenu_Win%)
5,6,15,16,20,21
4
adjust%
selecticon(FrameW%,icon%,1)
frame_shadeicons
WorkW%
icon%<=26
+
(icon%>=9)
((icon%
3)<>1)
"
click on arrow icons
) up%=((icon%
3)=2)
adjust%
i%=(icon%-9)
% j%=
($(IconText%(12+i%)))
i%<2
lo%=-10000
7 lo%=0 :
"size" field, can't be negative
.
changevar(j%,4,up%,lo%,10000)
'
seticontext(12+i%,
(j%))
'
setcaret(WorkW%,3*i%+10)
#! WinBlk%!0=LastMenu_Win%
$+
"Wimp_GetWindowState",,WinBlk%
icon%
27,28
'? xsize%=WinBlk%!12-WinBlk%!4+WinBlk%!20-WinBlk%!44
(? ysize%=WinBlk%!16-WinBlk%!8-WinBlk%!24+WinBlk%!56
icon%=27
*.
seticontext(12,
(WinBlk%!44))
+.
seticontext(13,
(WinBlk%!56))
,*
seticontext(14,
(xsize%))
-*
seticontext(15,
(ysize%))
.$
setcaret(WorkW%,16)
0*
seticontext(16,
(xsize%))
1*
seticontext(17,
(ysize%))
2$
setcaret(WorkW%,22)
5"
seticontext(12,"0")
6"
seticontext(13,"0")
7%
seticontext(14,"1236")
8$
seticontext(15,"936")
9"
seticontext(16,"0")
:"
seticontext(17,"0")
;"
setcaret(WorkW%,16)
setworkarea
>6
adjust%)
"Wimp_CreateMenu",,-1
A
OptPaneW%
icon%
D*
8 : TrapDclick%=
TrapDclick%
F.
iconselected(OptPaneW%,icon%)
support(1)
support(0)
L.
iconselected(OptPaneW%,icon%)
support(2)
support(0)
R.
iconselected(OptPaneW%,icon%)
support(3)
support(0)
W(
11 : DuplNames%=
DuplNames%
Hatch%=
Hatch%
redrawall
\+ IcInfo_Active%=
IcInfo_Active%
IcInfo_Active%
^%
openwindow(IcInfoW%,4)
`$
closewindow(IcInfoW%)
b4
14 : Save_Unselected%=
Save_Unselected%
c0
15 : DeleteOutside%=
DeleteOutside%
d2
35 : IgnoreDeskFont%=
IgnoreDeskFont%
e0
16 : Grid_SizeLock%=
Grid_SizeLock%
18,20
g& up%=(adjust%
(icon%=20))
hD
changevar(Grid_SizeX%,PixToOS_X%,up%,PixToOS_X%,64)
i-
seticontext(28,
(Grid_SizeX%))
22,24
l& up%=(adjust%
(icon%=24))
mD
changevar(Grid_SizeY%,PixToOS_Y%,up%,PixToOS_Y%,64)
n-
seticontext(29,
(Grid_SizeY%))
p.
25 : Grid_PosLock%=
Grid_PosLock%
27,29
r& up%=(adjust%
(icon%=29))
sC
changevar(Grid_PosX%,PixToOS_X%,up%,PixToOS_X%,64)
t,
seticontext(30,
(Grid_PosX%))
31,33
w& up%=(adjust%
(icon%=33))
xC
changevar(Grid_PosY%,PixToOS_Y%,up%,PixToOS_Y%,64)
y,
seticontext(31,
(Grid_PosY%))
{
OptionsW%
icon%
setup_save
#
closewindow(OptionsW%)
#
closewindow(OptionsW%)
DialW%
"Wimp_CreateMenu",,-1
LastDialogue%
,
program quit with changes made
icon%
2
"Wimp_GetPointerInfo",,PtrInfo%
' $(FileName%)=MainFname$
) $SaveFileIcon%="file_fec"
" SavingSelection%=
Exporting%=
QuitAfterSave%=
1
createwinmenu(-1,SaveW%,-126,56)
prequit
*
delete all with changes made
(
icon%=1
templ_deleteall
-
load new file with changes made
icon%=1
templ_deleteall
*
templ_loadfile(NewFname$,1)
&
setmainfname(NewFname$)
1
exit from desktop with changes made
icon%
templ_deleteall
A
resume prequit procedure (code copied from PRM)
5
"Wimp_GetCaretPosition",,ScrapBlk%
! ScrapBlk%!24=&1FC
@
"Wimp_SendMessage",8,ScrapBlk%,PreQuitSender%
wined_click(xpos%,ypos%,select%,adjust%,icon%)
up%,i%,gcol%
icon%
wined_readwin
wined_readwin
closewindow(WinEdW%)
setcaret(WinEd_Win%,-1)
closewindow(WinEdW%)
setcaret(WinEd_Win%,-1)
'
iconselected(WinEdW%,20)
;
selecticon(WinEdW%,14,
iconselected(WinEdW%,13))
'
iconselected(WinEdW%,20)
;
selecticon(WinEdW%,13,
iconselected(WinEdW%,14))
15,17,19,20
wined_shadeicons(icon%)
23,27,31,35,39,43,47,51
.
createmenu(xpos%,ypos%,WinEdW%,icon%)
22,24
" up%=(adjust%
(icon%=24))
0
changevar(WinEd_Button%,1,up%,0,15)
8
seticontext(6,$(WinButton%+20*WinEd_Button%))
WinEd_Col%(0)=7
WinEd_Col%(1)=2
WinEd_Col%(2)=7
WinEd_Col%(3)=1
WinEd_Col%(4)=3
WinEd_Col%(5)=1
WinEd_Col%(6)=12
i%=0
,
setcolourbox(2+i%,WinEd_Col%(i%))
7
(icon%>=26)
(icon%<=52)
((icon%
2)=0)
' up%=((icon%
4)=0)
adjust%
i%=(icon%-26)
( gcol%=
iconselected(WinEdW%,9)
;
changecolourbox(2+i%,WinEd_Col%(i%),1,up%,gcol%)
iced_click(xpos%,ypos%,select%,adjust%,icon%)
up%,l%
icon%
.
adjust%
iconselected(IcEdW%,14)
/
minimize number in 'Max size' field
&
iconselected(IcEdW%,12)
# l%=
($(IconText%(0)))
(
iconselected(IcEdW%,13)
# l%=
($(IconText%(1)))
!
seticontext(3,
(l%+1))
iced_readwin(-1)
iced_readwin(-1)
closewindow(IcEdW%)
setcaret(IcEd_Win%,-1)
closewindow(IcEdW%)
setcaret(IcEd_Win%,-1)
12,13,14,41,53
iced_shadeicons(icon%)
28,31,34,37,45,46,48,51
-
createmenu(xpos%,ypos%,IcEdW%,icon%)
27,29
" up%=(adjust%
(icon%=29))
/
changevar(IcEd_Button%,1,up%,0,15)
6
seticontext(4,$(IcButton%+20*IcEd_Button%))
30,32
" up%=(adjust%
(icon%=32))
,
changevar(IcEd_Esg%,1,up%,0,31)
&
seticontext(5,
(IcEd_Esg%))
33,35
" up%=(adjust%
(icon%=35))
/
changecolourbox(0,IcEd_Fgcol%,1,up%,0)
36,38
" up%=(adjust%
(icon%=38))
/
changecolourbox(1,IcEd_Bgcol%,1,up%,0)
47,49
;
(adjust%
(icon%=47))
(select%
(icon%=49))
IcEd_Xsize<998
IcEd_Xsize+=2
.
seticontext(20,
(IcEd_Xsize),4))
(
iconselected(IcEdW%,53)
# IcEd_Ysize=IcEd_Xsize
0
seticontext(21,
(IcEd_Ysize),4))
IcEd_Xsize>2
IcEd_Xsize-=2
.
seticontext(20,
(IcEd_Xsize),4))
(
iconselected(IcEdW%,53)
# IcEd_Ysize=IcEd_Xsize
0
seticontext(21,
(IcEd_Ysize),4))
50,52
;
(adjust%
(icon%=50))
(select%
(icon%=52))
IcEd_Ysize<998
IcEd_Ysize+=2
#.
seticontext(21,
(IcEd_Ysize),4))
%
IcEd_Ysize>2
IcEd_Ysize-=2
(.
seticontext(21,
(IcEd_Ysize),4))
*
receive(buf%)
sender%,ref%,code%,ackcode%,acktype%,fname$,ftype%,icon%,no%,boot$
selinfo%,item%
sender%=buf%!4
ref%=buf%!8
code%=buf%!16
4Cackcode%=0 :
sort of message to acknowledge this message with
5/acktype%=17 :
message type of acknowledge
sender% <> ThisTask%
code%
'quit' message
prequit
data save
buf%!40=&FEC
>>
other app saves file to TemplEd (via Wimp$Scrap)
?& NewLeafName$=
str(buf%+44)
@% $(buf%+44)="<Wimp$Scrap>"
A1 buf%!36=-1 :
saved file is "unsafe"
ackcode%=2
data save ack
fname$=
str(buf%+44)
Drag_Win%
SaveW%
Exporting%
J(
exporttemplates(fname$)
L$
SavingSelection%
M" SelFname$=fname$
N+
savetemplates(SelFname$)
P>
(buf%!36<>-1)
(fname$<>"<Wimp$Scrap>")
Q)
setmainfname(fname$)
S(
savetemplates(fname$)
ExportW%
W'
export_savenames(fname$)
Y3
"OS_File",17,fname$
ftype%,,,,fsize%
ftype%=1
ackcode%=3
buf%!36=fsize%
^"
"Wimp_CreateMenu",,-1
data load
a! NewFname$=
str(buf%+44)
buf%!40
&FEC
buf%!20
TemplW%
f-
setchanged(NrTemplates%>0)
g.
templ_loadfile(NewFname$,0)
ackcode%=4
j&
buf%!24=BarIcon%
k$
ChangesMade%
l%
dialogue(2,"")
n&
templ_deleteall
o2
templ_loadfile(NewFname$,1)
ackcode%=4
&FF9
u3
(buf%!20=-2)
(buf%!24=BarIcon%)
v+
loadusersprites(NewFname$)
ackcode%=4
&2000
z2 NewFname$=
str(buf%+44)+".Templates"
{H
fileexists(NewFname$)
(buf%!20=-2)
(buf%!24=BarIcon%)
|
ChangesMade%
}!
dialogue(2,"")
"
templ_deleteall
.
templ_loadfile(NewFname$,1)
ackcode%=4
"
double-click on a file
! NewFname$=
str(buf%+44)
buf%!40
&FEC
NrTemplates%=0
,
templ_loadfile(NewFname$,1)
ackcode%=4
desktop exit
ChangesMade%
ackcode%=8
acktype%=19
" PreQuitSender%=sender%
dialogue(8,"")
#
desktop save (RiscOS 3)
5 boot$="Run "+
readvarval("TemplEd$Dir")+
/
"OS_GBPB",2,buf%!20,boot$,
(boot$)
&502
*
request from !Help application
% no%=
whichtemplate(buf%!32)
icon%=buf%!36
$
(no%>=0)
(icon%>=-1)
+ $(buf%+20)=
iconhelp(no%,icon%)
ackcode%=&503
&400C0
!
about to open submenu
=
"MenuUtil_Decode",LastMenu%,buf%+32
,,selinfo%
item%=selinfo%!8
item%
item_createtempl%
'
template name to create
3
"MenuUtil_Text",item_templname%,""
/
item_copytempl%,item_renametempl%
sel_get(TemplW%)
/
template name to copy or rename
N
"MenuUtil_Text",item_templname%,$(TemplNames%+28*(SelBlk%!0))
item_exporttempl%
' $(FileName%)=ExportTname$
SavingSelection%=
Exporting%=
' $SaveFileIcon%="file_fff"
item_exportnames%
ExportType%
6 $(ExportName%)=
locase(ExportIname$)
- $(ExportName%)=ExportIname$
item_frame%
frame_fillwin
item_save%
+
set filename in save window
% $(FileName%)=MainFname$
SavingSelection%=
Exporting%=
' $SaveFileIcon%="file_fec"
item_savetempl%
0
set template name in save window
$ $(FileName%)=SelFname$
SavingSelection%=
Exporting%=
' $SaveFileIcon%="file_fec"
item_workarea%
-
fill icons in workarea window
% WinBlk%!0=LastMenu_Win%
.
"Wimp_GetWindowInfo",,WinBlk%
, $(IconText%(12))=
(WinBlk%!44)
, $(IconText%(13))=
(WinBlk%!56)
7 $(IconText%(14))=
(WinBlk%!52-WinBlk%!44)
7 $(IconText%(15))=
(WinBlk%!56-WinBlk%!48)
6 $(IconText%(16))=
((WinBlk%!72)
&FFFF)
2 $(IconText%(17))=
((WinBlk%!72)>>16)
:
"Wimp_CreateSubMenu",,buf%!20,buf%!24,buf%!28
&400C1
mode change
readscreenvars
=
TemplW_MaxCol%<TemplW_Cols%
redefinebrowser(
&400C9
1
menu removed with no menu item chosen
"
LastMenu%=TemplMenu%
:
TemplMenu_Deselect%
sel_clear(TemplW%,-1)
&80E1E
4
OLE file (user sprites) changed - reload
(
loadusersprites(SpriteFname$)
ackcode%<>0
buf%!0=256
buf%!12=ref%
buf%!16=ackcode%
-
"Wimp_SendMessage",17,buf%,sender%
redraw(handle%)
more%,win0x%,win0y%,dx%
xstart%,height%,xcorr%,ycorr%,x%,y%
dx%=48
Blk%!0=handle%
"Wimp_RedrawWindow",,Blk%
more%
win0x%=Blk%!4-Blk%!20
win0y%=Blk%!16-Blk%!24
more%
Hatch%
height%=Blk%!40-Blk%!32
xstart%=Blk%!28-height%
% xcorr%=(xstart%-win0x%)
% ycorr%=(win0y%-Blk%!32)
4
x%=xstart%-(xcorr%+ycorr%)
Blk%!36
x%,Blk%!32
1,height%,height%
% ycorr%=(win0y%-Blk%!40)
4
x%=xstart%-(xcorr%-ycorr%)
Blk%!36
x%,Blk%!40
1,height%,-height%
Support%
&
"Wimp_BorderWindow",,Blk%
%
"AEH_RedrawWindow",,Blk%
#
"WimpExt_Redraw",,Blk%
"Wimp_GetRectangle",,Blk%
more%
*** procs for the window-edit window ***
wined_fillwin(window%)
no%,flags%,i%
whichtemplate(window%)
WinEd_Win%=window%
WinBlk%!0=WinEd_Win%
"Wimp_GetWindowInfo",,WinBlk%
flags%=WinBlk%!32
"WinEd_Button%=(WinBlk%!64)>>12
i%=0
& WinEd_Col%(i%)=(WinBlk%?(36+i%))
selecticon(WinEdW%,4,flags%
(1<<1))
selecticon(WinEdW%,5,flags%
(1<<4))
selecticon(WinEdW%,6,flags%
(1<<12))
selecticon(WinEdW%,7,PaneFlag%?no%)
selecticon(WinEdW%,8,flags%
(1<<6))
selecticon(WinEdW%,9,flags%
(1<<10))
selecticon(WinEdW%,10,flags%
(1<<11))
selecticon(WinEdW%,20,flags%
(1<<31))
selecticon(WinEdW%,57,flags%
(1<<13))
selecticon(WinEdW%,59,flags%
(1<<8))
selecticon(WinEdW%,60,flags%
(1<<9))
selecticon(WinEdW%,62,flags%
(1<<14))
selecticon(WinEdW%,63,flags%
(1<<15))
i%=0
selecticon(WinEdW%,13+i%,flags%
(1<<(24+i%)))
(flags%
(1<<31))=0
selecticon(WinEdW%,14,(flags%
(1<<7))=0)
selecticon(WinEdW%,13,(flags%
(1<<7))=0)
selecticon(WinEdW%,15,flags%
(1<<0))
selecticon(WinEdW%,17,flags%
(1<<2))
selecticon(WinEdW%,19,flags%
(1<<3))
settitlebar(WinEdW%,WinEdTbar%,
msg_lookup1("EDTP",$(TemplNames%+28*no%)))
seticontext(6,$(WinButton%+20*WinEd_Button%))
i%=0
setcolourbox(2+i%,WinEd_Col%(i%))
wined_shadeicons(-1)
openwindow(WinEdW%,0)
setcaret(WinEdW%,-1)
wined_shadeicons(clickedon%)
newformat%,titlebar%,scroll%
?(newformat%=
iconselected(WinEdW%,20)
@'titlebar%=
iconselected(WinEdW%,15)
AAscroll%=
iconselected(WinEdW%,17)
iconselected(WinEdW%,19)
(clickedon%=-1)
(clickedon%=20)
shadeicon(WinEdW%,16,
newformat%)
(clickedon%=-1)
(clickedon%=15)
shadeicon(WinEdW%,13,
titlebar%)
shadeicon(WinEdW%,14,
titlebar%)
shadeicon(WinEdW%,16,
titlebar%)
(clickedon%<>15)
shadeicon(WinEdW%,18,newformat%
scroll%))
wined_readwin
flags%,no%,i%
WinBlk%!0=WinEd_Win%
"Wimp_GetWindowInfo",,WinBlk%
S!flags%=(WinBlk%!32)
(&1F<<16)
iconselected(WinEdW%,15)
flags%+=(1<<0)
iconselected(WinEdW%,4)
flags%+=(1<<1)
iconselected(WinEdW%,17)
flags%+=(1<<2)
iconselected(WinEdW%,19)
flags%+=(1<<3)
iconselected(WinEdW%,5)
flags%+=(1<<4)
Y"no%=
whichtemplate(WinEd_Win%)
iconselected(WinEdW%,7)
PaneFlag%?no%=1<<5
PaneFlag%?no%=0
iconselected(WinEdW%,8)
flags%+=(1<<6)
iconselected(WinEdW%,14)
flags%+=(1<<7)
iconselected(WinEdW%,59)
flags%+=(1<<8)
iconselected(WinEdW%,60)
flags%+=(1<<9)
iconselected(WinEdW%,9)
flags%+=(1<<10)
iconselected(WinEdW%,10)
flags%+=(1<<11)
iconselected(WinEdW%,6)
flags%+=(1<<12)
iconselected(WinEdW%,57)
flags%+=(1<<13)
iconselected(WinEdW%,62)
flags%+=(1<<14)
iconselected(WinEdW%,63)
flags%+=(1<<15)
i%=0
iconselected(WinEdW%,13+i%)
flags%+=(1<<(24+i%))
WinBlk%!32=flags%
m WinBlk%!64=WinEd_Button%<<12
i%=0
o$ WinBlk%?(36+i%)=WinEd_Col%(i%)
q)WinEd_Win%=
redefinewindow(WinBlk%,1)
*** procs for the icon-edit window ***
iced_start(window%,icon%)
icon%=-4
iced_fillwin(window%,-4)
sel_get(window%)
NrSelected%>0
NrSelected%=1
}*
iced_fillwin(window%,SelBlk%!0)
$
iced_fillwin(window%,-1)
(icon%>=0)
&
iced_fillwin(window%,icon%)
iced_fillwin(window%,icon%)
no%,flags%,data%,arg$,title$,text%,sprite%,indir%,caretto%
t$,v$,m$,s$
IcEd_Win%=window%
IcEd_Icon%=icon%
whichtemplate(window%)
WinBlk%!0=IcEd_Win%
"Wimp_GetWindowInfo",,WinBlk%
icon%
-4 :
editing title bar icon
D flags%=(WinBlk%!60)
&FF000FFF :
mask out irrelevant bits
flags%=flags%
(flags%
(1<<6))=0
;
copy fg and bg colour flags from window colours
J flags%=(flags%
&FFF)
((WinBlk%?36)<<24)
((WinBlk%?37)<<28)
data%=WinBlk%+76
" arg$+=
msg_lookup0("TBAR")
-1 :
editing selection (read flags from first icon)
sel_get(IcEd_Win%)
- flags%=WinBlk%!(92+32*(SelBlk%!0)+16)
* data%=WinBlk%+92+32*(SelBlk%!0)+20
! arg$+=
msg_lookup0("SEL")
editing single icon
, flags%=WinBlk%!(92+32*IcEd_Icon%+16)
) data%=WinBlk%+92+32*IcEd_Icon%+20
+ arg$+=
msg_lookup1("ICNR",
(icon%))
:title$=
msg_lookup2("EDIC",$(TemplNames%+28*no%),arg$)
text%=(flags%
1)>0
sprite%=(flags%
2)>0
indir%=(flags%
&100)>0
text%
indir%
t$=
str(data%!0)
m$=
(data%!8)
(
data%!4<>-1
str(data%!4)
t$=
str(data%),12)
sprite%
text%)
indir%
s$=
str(data%!0)
m$=
(data%!8)
s$=
str(data%),12)
"IcEd_Button%=(flags%>>12)
IcEd_Esg%=(flags%>>16)
(flags%
(1<<6))
IcEd_Fgcol%=7
IcEd_Bgcol%=0
font_getinfo((flags%>>24)
255,IcEd_Font$,IcEd_Xsize,IcEd_Ysize)
# IcEd_Fgcol%=(flags%>>24)
# IcEd_Bgcol%=(flags%>>28)
" IcEd_Font$="Homerton.Medium"
IcEd_Xsize=12
IcEd_Ysize=12
settitlebar(IcEdW%,IcEdTbar%,title$)
selecticon(IcEdW%,12,text%)
selecticon(IcEdW%,13,sprite%)
selecticon(IcEdW%,14,indir%)
seticontext(0,t$)
seticontext(1,s$)
seticontext(2,v$)
seticontext(3,m$)
selecticon(IcEdW%,15,flags%
(1<<2))
selecticon(IcEdW%,17,flags%
(1<<3))
selecticon(IcEdW%,18,flags%
(1<<4))
selecticon(IcEdW%,16,flags%
(1<<5))
selecticon(IcEdW%,41,flags%
(1<<6))
selecticon(IcEdW%,20,flags%
(1<<7))
selecticon(IcEdW%,19,flags%
(1<<9))
selecticon(IcEdW%,21,flags%
(1<<10))
selecticon(IcEdW%,22,flags%
(1<<11))
selecticon(IcEdW%,39,flags%
(1<<22))
seticontext(4,$(IcButton%+20*IcEd_Button%))
seticontext(5,
(IcEd_Esg%))
setcolourbox(0,IcEd_Fgcol%)
setcolourbox(1,IcEd_Bgcol%)
seticontext(19,IcEd_Font$)
seticontext(20,
(IcEd_Xsize),4))
seticontext(21,
(IcEd_Ysize),4))
selecticon(IcEdW%,53,IcEd_Xsize=IcEd_Ysize)
i%=12
shadeicon(IcEdW%,i%,IcEd_Icon%=-1)
IcEd_Icon%=-1
i%=23
shadeicon(IcEdW%,i%,1)
shadeicon(IcEdW%,15,IcEd_Icon%=-4)
shadeicon(IcEdW%,16,IcEd_Icon%=-4)
shadeicon(IcEdW%,20,IcEd_Icon%=-4)
shadeicon(IcEdW%,21,IcEd_Icon%=-4)
i%=27
shadeicon(IcEdW%,i%,IcEd_Icon%=-4)
shadeicon(IcEdW%,39,IcEd_Icon%=-4)
iced_shadeicons(-1)
openwindow(IcEdW%,0)
caretto%=-1
IcEd_Icon%<>-1
indir%
caretto%=25
sprite%
caretto%=24
text%
caretto%=23
setcaret(IcEdW%,caretto%)
iced_shadeicons(clickedon%)
t%,s%,i%,f%,lockaspect%
IcEd_Icon%<>-1
(clickedon%=-1)
(clickedon%<=14)
# t%=
iconselected(IcEdW%,12)
# s%=
iconselected(IcEdW%,13)
# i%=
iconselected(IcEdW%,14)
"
shadeicon(IcEdW%,23,
0
shadeicon(IcEdW%,24,(
s%)
(t%
i%))
(
shadeicon(IcEdW%,25,
i%))
"
shadeicon(IcEdW%,26,
iconselected(IcEdW%,41)
(lockaspect%=
iconselected(IcEdW%,53)
(clickedon%=-1)
(clickedon%=41)
i%=33
shadeicon(IcEdW%,i%,f%)
i%=45
"
shadeicon(IcEdW%,i%,
shadeicon(IcEdW%,53,
(clickedon%=-1)
(clickedon%=41)
(clickedon%=53)
i%=50
2
shadeicon(IcEdW%,i%,(
f%)
lockaspect%)
"Wimp_GetCaretPosition",,ScrapBlk%
iconshaded(ScrapBlk%!0,ScrapBlk%!4)
setcaret(IcEdW%,-1) :
move caret from shaded icon
iced_readwin(mask%)
flags%,flagptr%,data%,ib%,cbp%,xsize,ysize
xsize16%,ysize16%,fhandle%
i%,t%,s%,deflen%,maxlen%,p%
WinBlk%!0=IcEd_Win%
"Wimp_GetWindowInfo",,WinBlk%
IcEd_Icon%
-4 :
editing title bar icon
flagptr%=WinBlk%+60
data%=WinBlk%+76
-1 :
editing selection (read flags from first icon)
sel_get(IcEd_Win%)
+- flagptr%=WinBlk%+92+32*(SelBlk%!0)+16
,* data%=WinBlk%+92+32*(SelBlk%!0)+20
editing single icon
IcEd_Icon%>=0
/. flagptr%=WinBlk%+92+32*IcEd_Icon%+16
0+ data%=WinBlk%+92+32*IcEd_Icon%+20
1& ib%=WinBlk%+92+32*IcEd_Icon%
2
cbp%=WinBlk%!68
construct new flags, but do not change "selected" state
6!flags%=(flagptr%!0)
(1<<21)
iconselected(IcEdW%,15)
flags%+=(1<<2)
iconselected(IcEdW%,16)
flags%+=(1<<5)
iconselected(IcEdW%,17)
flags%+=(1<<3)
iconselected(IcEdW%,18)
flags%+=(1<<4)
iconselected(IcEdW%,19)
flags%+=(1<<9)
iconselected(IcEdW%,20)
flags%+=(1<<7)
iconselected(IcEdW%,21)
flags%+=(1<<10)
iconselected(IcEdW%,22)
flags%+=(1<<11)
iconselected(IcEdW%,39)
flags%+=(1<<22)
flags%+=(IcEd_Button%<<12)
flags%+=(IcEd_Esg%<<16)
iconselected(IcEdW%,41)
flags%+=(1<<6)
xsize16%=
(IcEd_Xsize*16)
ysize16%=
(IcEd_Ysize*16)
xsize16%<=0
xsize16%=12*16
ysize16%<=0
ysize16%=12*16
"Font_FindFont",,IconText%(19),xsize16%,ysize16%,0,0
fhandle%
FontUsage%(fhandle%)>0
J?
"Font_LoseFont",fhandle% :
font was already in use
FontUsage%(fhandle%)+=1
flags%+=(fhandle%<<24)
flags%+=(IcEd_Fgcol%<<24)
flags%+=(IcEd_Bgcol%<<28)
(IcEd_Icon%>=0)
(IcEd_Icon%=-4)
iconrelease(flagptr%!0,data%)
T! t%=
iconselected(IcEdW%,12)
U! s%=
iconselected(IcEdW%,13)
V! i%=
iconselected(IcEdW%,14)
t%)
X= deflen%=
($(IconText%(1)))+1 :
default maximum size
Z$ deflen%=
($(IconText%(0)))+1
]" maxlen%=
($(IconText%(3)))
maxlen%=12
maxlen%<deflen%
bN maxlen%=deflen% :
increase max size if text is longer
c"
seticontext(3,
(maxlen%))
i%)
(deflen%>12)
fE
selecticon(IcEdW%,14,1) :
make indirected if > 12 chars
gA
seticontext(2,"") :
default validation string
iced_shadeicons(14)
i%=
flags%+=(1<<0)
flags%+=(1<<1)
flags%+=(1<<8)
t%)
data%!0=IconText%(1)
qD data%!4=cbp% :
window CBP as default sprite area pointer
r
data%!0=IconText%(0)
u"
($(IconText%(2)))>0
v data%!4=IconText%(2)
x2 data%!4=-1 :
empty validation string
z
data%!8=maxlen%
~" $(data%)=$(IconText%(0))
$ $(data%)=$(IconText%(1))
flagptr%!0=flags%
iconrealloc(flagptr%,data%)
IcEd_Icon%
WinBlk%?36=IcEd_Fgcol%
WinBlk%?37=IcEd_Bgcol%
, IcEd_Win%=
redefinewindow(WinBlk%,1)
A
do not change text, sprite and indir flags of selection
mask%=mask%
&103)
NrSelected%>0
i%=0
NrSelected%-1
H
seticonstate(IcEd_Win%,SelBlk%!(4*i%),flags%
mask%,mask%)
dialogue(9,"")
IcEd_Icon%>=0
> IcEd_Icon%=
redefineicon(IcEd_Win%,IcEd_Icon%,ib%-8)
dialogue(4,"")
iconselected(IcEdW%,41)
font count was increased earlier when finding font handle
font_lose(fhandle%)
setchanged(
*** menu procs ***
menu_add(text$,submenu%,genmsg%)
handle%
"MenuUtil_Add",,text$
handle%
submenu%<>-1
"MenuUtil_SubMenu",handle%,submenu%
genmsg%
"MenuUtil_Warning",handle%,1
=handle%
menu_addwritable(maxlen%,validstr%)
handle%
"MenuUtil_Add",,""
handle%
"MenuUtil_Writable",,1,maxlen%,validstr%
=handle%
--- shade a whole submenu, but keep it accessible ---
menu_fadesubmenu(item%,submenu%,switch%)
switch%
"MenuUtil_Colours",item%,2,0
"MenuUtil_Fade",submenu%,1
"MenuUtil_Colours",item%,7,0
"MenuUtil_Fade",submenu%,0
preparemenus
"MenuUtil_Initialise",010,0
--- custom sprites menu
"MenuUtil_New",,"Sprites"
SpritesMenu%
-item_sprview%=
menu_add("View/Edit",-1,0)
-item_sprreload%=
menu_add("Re-load",-1,0)
*item_sprreset%=
menu_add("Reset",-1,0)
--- iconbar menu
"MenuUtil_New",,Appl$
MainMenu%
)item_info%=
menu_add("Info",InfoW%,0)
OSversion%>=300
' item_help%=
menu_add("Help",-1,0)
item_help%=0
.item_options%=
menu_add("Options...",-1,0)
/item_stats%=
menu_add("Statistics...",-1,0)
Bitem_customsprites%=
menu_add("Custom sprites",SpritesMenu%,0)
%item_quit%=
menu_add("Quit",-1,0)
--- template-name menu
"MenuUtil_New",," Name: "
TemplNamemenu%
+item_templname%=
menu_addwritable(12,0)
--- template submenu
"MenuUtil_New",,""
TemplSubmenu%
6item_copytempl%=
menu_add("Copy",TemplNamemenu%,1)
:item_renametempl%=
menu_add("Rename",TemplNamemenu%,1)
.item_deletetempl%=
menu_add("Delete",-1,0)
*item_opentempl%=
menu_add("Open",-1,0)
,item_closetempl%=
menu_add("Close",-1,0)
.item_savetempl%=
menu_add("Save",SaveW%,1)
--- export submenu
"MenuUtil_New",,"Export"
ExportMenu%
8item_exportnames%=
menu_add("Icon names",ExportW%,1)
5item_exporttempl%=
menu_add("Templates",SaveW%,1)
--- template menu
"MenuUtil_New",,Appl$
TemplMenu%
:item_createtempl%=
menu_add("Create",TemplNamemenu%,1)
0item_template%=
menu_add("",TemplSubmenu%,0)
2item_selalltempl%=
menu_add("Select all",-1,0)
9item_clearseltempl%=
menu_add("Clear selection",-1,0)
2item_export%=
menu_add("Export",ExportMenu%,1)
0item_deleteall%=
menu_add("Delete all",-1,0)
4item_sorttempl%=
menu_add("Sort templates",-1,0)
)item_save%=
menu_add("Save",SaveW%,1)
--- direction menu for icon copying
"MenuUtil_New",,"Copy"
DirMenu%
'item_up%=
menu_add("Up ^U",-1,0)
)item_down%=
menu_add("Down ^D",-1,0)
)item_left%=
menu_add("Left ^L",-1,0)
*item_right%=
menu_add("Right ^R",-1,0)
--- menu for icon renumbering
"MenuUtil_New",,"No.:"
IconNrmenu%
2item_iconnr%=
menu_addwritable(4,NumValidStr%)
--- "dimension" menu
"MenuUtil_New",,"Dim."
DimensionMenu%
%item_both%=
menu_add("Both",-1,0)
"item_xdim%=
menu_add("X",-1,0)
"item_ydim%=
menu_add("Y",-1,0)
--- user-template submenu
"MenuUtil_New",,""
UserSubmenu%
7item_copyicon%=
menu_add("Copy ^C",DirMenu%,0)
:item_renumbericon%=
menu_add("Renumber",IconNrmenu%,0)
3item_deleteicon%=
menu_add("Delete ^X",-1,0)
1item_editicon%=
menu_add("Edit... ^E",-1,0)
"MenuUtil_Dots",,1
3item_align%=
menu_add("Align ^J",AlignW%,0)
6item_spaceout%=
menu_add("Space out ^K",SpaceW%,0)
3item_frame%=
menu_add("Frame ^F",FrameW%,1)
9item_minsize%=
menu_add("Min. size",DimensionMenu%,0)
9item_centericon%=
menu_add("Center",DimensionMenu%,0)
:item_samesize%=
menu_add("Same size",DimensionMenu%,0)
--- sprite area menu
"MenuUtil_New",,"Sprites from"
SpriteAreaMenu%
.item_wimparea%=
menu_add("Wimp area",-1,0)
2item_customarea%=
menu_add("Custom area",-1,0)
--- submenus for tidying icons
"MenuUtil_New",,"Ensure"
EnsureMenu%
2item_tidy1%=
menu_add("Inside work area",-1,0)
5item_tidy2%=
menu_add("Inside visible area",-1,0)
"MenuUtil_New",,"Deleted"
DeletedMenu%
*item_tidy3%=
menu_add("Undelete",-1,0)
1item_tidy4%=
menu_add("Undelete & Move",-1,0)
'item_tidy5%=
menu_add("Purge",-1,0)
--- "misc" submenu
"MenuUtil_New",,"Misc"
MiscMenu%
6item_centerwin%=
menu_add("Center to screen",-1,0)
?item_spritearea%=
menu_add("Sprite area",SpriteAreaMenu%,0)
=item_ensureicons%=
menu_add("Ensure icons",EnsureMenu%,0)
@item_deletedicons%=
menu_add("Deleted icons",DeletedMenu%,0)
--- user-template menu
"MenuUtil_New",,"Window"
UserMenu%
5item_createicon%=
menu_add("Create icon...",-1,0)
+item_icon%=
menu_add("",UserSubmenu%,0)
;item_selallicons%=
menu_add("Select all ^A",-1,0)
=item_clearselicons%=
menu_add("Clear selection ^Z",-1,0)
"MenuUtil_Dots",item_clearselicons%,1
2item_workarea%=
menu_add("Work area",WorkW%,1)
!:item_editwindow%=
menu_add("Edit window... ^W",-1,0)
"9item_edittitle%=
menu_add("Edit title... ^T",-1,0)
#,item_misc%=
menu_add("Misc",MiscMenu%,0)
$8item_closewin%=
menu_add("Close window ^Q",-1,0)
--- menu with icon button-types
"MenuUtil_New",,"Button type"
IcButtonMenu%
i%=0
(/ dummy%=
menu_add($(IcButton%+20*i%),-1,0)
--- menu with window button-types
"MenuUtil_New",,"Button type"
WinButtonMenu%
i%=0
-0 dummy%=
menu_add($(WinButton%+20*i%),-1,0)
--- actual ESG menu is built when Menu is clicked
EsgMenu%=0
--- actual colour menu is built when Menu is clicked
ColourMenu%=0
--- font menu
fontmenu
--- font size menu
"MenuUtil_New",,"Size"
FontSizemenu%
"MenuUtil_Add",,"10pt"
"MenuUtil_Add",,"12pt"
"MenuUtil_Add",,"16pt"
"MenuUtil_Add",,"20pt"
"MenuUtil_Add",,"24pt"
"MenuUtil_Add",,"36pt"
=6item_fontsize%=
menu_addwritable(5,FpNumValidStr%)
--- "partial update" submenu
"MenuUtil_New",,"Other"
UpdateSubmenu%
@(item_updbo%=
menu_add("Border",-1,0)
A(item_updfi%=
menu_add("Filled",-1,0)
B*item_updhc%=
menu_add("H centre",-1,0)
C*item_updvc%=
menu_add("V centre",-1,0)
D-item_updrj%=
menu_add("R justified",-1,0)
E,item_updnh%=
menu_add("Needs help",-1,0)
F.item_updaa%=
menu_add("Allow adjust",-1,0)
G+item_updhs%=
menu_add("Half size",-1,0)
H(item_updsh%=
menu_add("Shaded",-1,0)
--- "partial update" menu
"MenuUtil_New",,"Update"
Updatemenu%
K-item_updbt%=
menu_add("Button type",-1,0)
L&item_updesg%=
menu_add("ESG",-1,0)
M(item_updfg%=
menu_add("Fg col",-1,0)
N(item_updbg%=
menu_add("Bg col",-1,0)
O(item_updfont%=
menu_add("Font",-1,0)
P;item_updrest%=
menu_add("Other flags",UpdateSubmenu%,0)
mainmenu
"MenuUtil_Fade",item_stats%,NrTemplates%=0
menu_fadesubmenu(item_customsprites%,SpritesMenu%,UserSprites%=1)
templatemenu(
xpos%,
ypos%,icon%)
sel_get(TemplW%)
(NrSelected%=0)
(icon%>=0)
\"
selecticon(TemplW%,icon%,1)
SelBlk%!0=icon%
NrSelected%=1
_D TemplMenu_Deselect%=
deselect icon when menu is removed?
TemplMenu_Deselect%=
menu_fadesubmenu(item_template%,TemplSubmenu%,NrSelected%=0)
d t$=""
NrSelected%>1
t$="Selection"
g)
"MenuUtil_Text",TemplSubmenu%,t$
NrSelected%=1
j( t$=$(TemplNames%+28*(SelBlk%!0))
l1
"MenuUtil_Text",TemplSubmenu%,"Template"
"MenuUtil_Fade",item_copytempl%,NrSelected%<>1
"MenuUtil_Fade",item_renametempl%,NrSelected%<>1
SelFname$=t$
NrSelected%>1
r3
"MenuUtil_Text",item_template%,"Selection"
t;
"MenuUtil_Text",item_template%,"Template '"+t$+"'"
"MenuUtil_Fade",item_selalltempl%,NrTemplates%=0
"MenuUtil_Fade",item_clearseltempl%,NrSelected%=0
"MenuUtil_Fade",item_deleteall%,NrTemplates%=0
"MenuUtil_Fade",item_sorttempl%,NrTemplates%=0
menu_fadesubmenu(item_export%,ExportMenu%,NrTemplates%=0)
"MenuUtil_Fade",item_save%,NrTemplates%=0
QuitAfterSave%=
xpos%-=64
NrSelected%=0
ypos%+=22
ypos%+=66
usermenu(
xpos%,
ypos%,window%,icon%)
t$,st$
sel_get(window%)
(NrSelected%=0)
(icon%>=0)
SelBlk%!0=icon%
NrSelected%=1
menu_fadesubmenu(item_icon%,UserSubmenu%,NrSelected%=0)
NrSelected%
t$="No icon"
st$=t$
t$="Icon #"+
(SelBlk%!0)
st$=t$
t$="Selection"
# st$=
(NrSelected%)+" icons"
"MenuUtil_Text",UserSubmenu%,st$
"MenuUtil_Fade",item_renumbericon%,NrSelected%=0
"MenuUtil_Fade",item_align%,NrSelected%<2
"MenuUtil_Fade",item_spaceout%,NrSelected%<2
"MenuUtil_Fade",item_frame%,NrSelected%<2
"MenuUtil_Text",item_iconnr%,
(NextIconNr%)
"MenuUtil_Fade",item_samesize%,NrSelected%<2
WinBlk%!0=window%
"Wimp_GetWindowInfo",,WinBlk%
WinBlk%!68=1
"MenuUtil_TickOnly",SpriteAreaMenu%,0
"MenuUtil_TickOnly",SpriteAreaMenu%,1
"MenuUtil_Text",item_icon%,t$
"MenuUtil_Fade",item_selallicons%,WinBlk%!88=0
"MenuUtil_Fade",item_clearselicons%,NrSelected%=0
menu_fadesubmenu(item_ensureicons%,EnsureMenu%,WinBlk%!88=0)
"Wimp_WhichIcon",window%,SelBlk2%,1<<23,1<<23 :
any deleted icons?
menu_fadesubmenu(item_deletedicons%,DeletedMenu%,SelBlk2%!0=-1)
menu_fadesubmenu(item_spritearea%,SpriteAreaMenu%,UserSprites%=1)
xpos%-=64
NrSelected%=0
ypos%+=22
ypos%+=66
icbuttonmenu(
xpos%,
ypos%)
"MenuUtil_TickOnly",IcButtonMenu%,IcEd_Button%
xpos%+=16
ypos%+=22+IcEd_Button%*44
winbuttonmenu(
xpos%,
ypos%)
"MenuUtil_TickOnly",WinButtonMenu%,WinEd_Button%
xpos%+=16
ypos%+=22+WinEd_Button%*44
esgmenu(
xpos%,
ypos%)
EsgMenu%<>0
"MenuUtil_Delete",EsgMenu%,
Support%=2
"MenuUtil_New",,"ESG"
EsgMenu%
. dummy%=
menu_addwritable(3,NumValidStr%)
"MenuUtil_Text",,
(IcEd_Esg%)
* dummy%=
menu_add("16 (Action)",-1,0)
2 dummy%=
menu_add("18 (Default action)",-1,0)
, dummy%=
menu_add("19 (Writable)",-1,0)
+ dummy%=
menu_add("20 (Display)",-1,0)
- dummy%=
menu_add("21 (Group box)",-1,0)
0 dummy%=
menu_add("24 (24bit colour)",-1,0)
* dummy%=
menu_add("25 (Slider)",-1,0)
ypos%+=22
"MenuUtil_New",,"ESG"
EsgMenu%
i%=0
$ dummy%=
menu_add(
(i%),-1,0)
ypos%+=22
IcEd_Esg%<=15
1
"MenuUtil_TickOnly",EsgMenu%,IcEd_Esg%
ypos%+=IcEd_Esg%*44
xpos%+=16
colourmenu(
xpos%,
ypos%,window%,icon%)
i%,flags%,current%,bigrange%,transp%
ColourMenu%<>0
"MenuUtil_Delete",ColourMenu%,
window%
IcEdW%
icon%
%
34 : current%=IcEd_Fgcol%
%
37 : current%=IcEd_Bgcol%
bigrange%=
transp%=
WinEdW%
* bigrange%=
iconselected(WinEdW%,9)
% transp%=(icon%=27)
(icon%=39)
) current%=WinEd_Col%((icon%-27)
bigrange%
colour menu for colour numbers 0-255 (GCOL colours)
"MenuUtil_New",,"Col"
ColourMenu%
. dummy%=
menu_addwritable(4,NumValidStr%)
"MenuUtil_Text",,
(current%)
transp%
!
"MenuUtil_Add",,"None"
(
"MenuUtil_Tick",,current%=255
colour menu for colour numbers 0-15
"MenuUtil_New",,"Col"
ColourMenu%
i%=0
"MenuUtil_Add",,
4
"MenuUtil_Colours",,InverseColour%(i%),i%
transp%
"MenuUtil_Dots",,1
!
"MenuUtil_Add",,"None"
current%=255
-
"MenuUtil_TickOnly",ColourMenu%,16
3
"MenuUtil_TickOnly",ColourMenu%,current%
xpos%+=16
ypos%+=22
bigrange%)
current%=255
ypos%+=16*44+22
ypos%+=current%*44
fontmenu
next%,font$,fam$,style$,p%,submenu%,item%
"MenuUtil_New",,"Font"
FontMenu%
fam$=""
next%=0
f$=
40," ")
"Font_ListFonts",,FontData%,next%,-1
,,next%
next%<>-1
f$=$(FontData%)
p%=
f$,".")
p%>0
style$=
f$,p%+1)
f$=
f$,p%-1)
style$="(Regular)"
"
#$
(f$<>fam$)
(next%<>-1)
new font family
fam$=f$
&2
"MenuUtil_Add",FontMenu%,fam$
item%
',
"MenuUtil_New",,fam$
submenu%
(.
"MenuUtil_SubMenu",item%,submenu%
)
*)
"MenuUtil_Add",submenu%,style$
next%=-1
fontsizemenu(
xpos%,
ypos%,window%,icon%)
icon%=48
"MenuUtil_Text",item_fontsize%,
(IcEd_Xsize),5)
"MenuUtil_Text",item_fontsize%,
(IcEd_Ysize),5)
ypos%+=7*44
updatemenu(
xpos%,
ypos%,window%,icon%)
font%
:"font%=
iconselected(IcEdW%,41)
"MenuUtil_Fade",item_updfg%,font%
"MenuUtil_Fade",item_updbg%,font%
"MenuUtil_Fade",item_updfont%,
font%
ypos%+=22
createmenu(xpos%,ypos%,window%,icon%)
LastMenu_X%=xpos%
LastMenu_Y%=ypos%
LastMenu_Win%=window%
LastMenu_Icon%=icon%
LastMenu%=-1
window%
mainmenu
LastMenu%=MainMenu%
TemplW%
L(
templatemenu(xpos%,ypos%,icon%)
LastMenu%=TemplMenu%
IcEdW%
icon%
9,10
IcEd_Icon%=-1
R4
updatemenu(xpos%,ypos%,window%,icon%)
S# LastMenu%=Updatemenu%
V&
icbuttonmenu(xpos%,ypos%)
W# LastMenu%=IcButtonMenu%
Y!
esgmenu(xpos%,ypos%)
LastMenu%=EsgMenu%
34,37
\2
colourmenu(xpos%,ypos%,window%,icon%)
]! LastMenu%=ColourMenu%
45,46
xpos%+=16
ypos%+=22
LastMenu%=FontMenu%
48,51
c4
fontsizemenu(xpos%,ypos%,window%,icon%)
d# LastMenu%=FontSizemenu%
e
WinEdW%
icon%
i'
winbuttonmenu(xpos%,ypos%)
j$ LastMenu%=WinButtonMenu%
k
27,31,35,39,43,47,51
l2
colourmenu(xpos%,ypos%,window%,icon%)
m! LastMenu%=ColourMenu%
n
p&
whichtemplate(window%)>=0
q.
usermenu(xpos%,ypos%,window%,icon%)
LastMenu%=UserMenu%
s
LastMenu%<>-1
ScrapBlk%!0=xpos%
ScrapBlk%!4=ypos%
ScrapBlk%!12=window%
"MenuUtil_Show",LastMenu%,ScrapBlk%
create a window-menu
createwinmenu(window%,menuwin%,xofs%,yofs%)
"Wimp_GetPointerInfo",,PtrInfo%
"Wimp_CreateMenu",,menuwin%,PtrInfo%!0+xofs%,PtrInfo%!4+yofs%
LastMenu_Win%=window%
LastMenu_Icon%=-1
*** drag procs; for moving and resizing icons ***
finishdrag(xmin%,ymin%,xmax%,ymax%)
win0x%,win0y%,i%,iconblk%,inbox%
setmouseshape(0) :
restore default pointer shape
xmin%>xmax%
xmin%,xmax%
ymin%>ymax%
ymin%,ymax%
"Wimp_GetPointerInfo",,PtrInfo%
Drag_Type%
0,1 :
move / resize icon(s)
*
whichtemplate(PtrInfo%!12)>=0
WinBlk%!0=PtrInfo%!12
*
"Wimp_GetWindowInfo",,WinBlk%
% win0x%=WinBlk%!4-WinBlk%!20
& win0y%=WinBlk%!16-WinBlk%!24
I xmin%-=win0x% :
translate from screen coords to window coords
ymin%-=win0y%
xmax%-=win0x%
ymax%-=win0y%
O
moveresize(Drag_Win%,Drag_Icon%,PtrInfo%!12,xmin%,ymin%,xmax%,ymax%)
A
setcaret(PtrInfo%!12,-1) :
move focus to this window
-
DeleteOutside%
(Drag_Type%=0)
D
moved icons outside window - delete them if option set
"
i%=0
NrSelected%-1
7
deleteicon(Drag_Win%,SelBlk%!(4*i%),1,1)
2,3 :
drag-select icons (with Select/Adjust)
WinBlk%!0=Drag_Win%
(
"Wimp_GetWindowInfo",,WinBlk%
# win0x%=WinBlk%!4-WinBlk%!20
$ win0y%=WinBlk%!16-WinBlk%!24
xmin%-=win0x%
xmax%-=win0x%
ymin%-=win0y%
ymax%-=win0y%
>
(WinBlk%!88>0)
((xmax%-xmin%)+(ymax%-ymin%)>=32)
i%=0
WinBlk%!88-1
% iconblk%=WinBlk%+92+i%*32
; inbox%=(iconblk%!0<xmax%)
(iconblk%!8>=xmin%)
E inbox%=inbox%
(iconblk%!4<ymax%)
(iconblk%!12>=ymin%)
)
inbox%
(i%<>Drag_Icon%)
Drag_Type%=2
+
selecticon(Drag_Win%,i%,1)
3
seticonstate(Drag_Win%,i%,1<<21,0)
4 :
drag from save-box
.
DragASprite%
"DragASprite_Stop"
Blk%!0=256
Blk%!12=0
Blk%!16=1
Blk%!20=PtrInfo%!12
Blk%!24=PtrInfo%!16
Blk%!28=PtrInfo%!0
Blk%!32=PtrInfo%!4
Drag_Win%
SaveW%
Exporting%
Blk%!36=1
Blk%!40=&FFF
G Blk%!36=20+112*NrTemplates% :
low estimate of file size
Blk%!40=&FEC
. $(Blk%+44)=
leafname($(FileName%))
ExportW%
Blk%!36=1
ExportType%
0 : Blk%!40=&FFB
"
1,2 : Blk%!40=&FFF
0 $(Blk%+44)=
leafname($(ExportName%))
=
"Wimp_SendMessage",17,Blk%,PtrInfo%!12,PtrInfo%!16
5,6,7
L
window move/resize/workresize - do nothing (no drag event anyway!)
Drag_Type%=-1
initdrag(type%,window%,icon%,box0x%,box0y%)
"OS_Byte",161,&1C
,,b% :
read "dragasprite" bit in CMOS RAM (RO3)
DragASprite%=(b%
2)<>0
DragASprite%
(type%=4)
ScrapBlk%!0=window%
ScrapBlk%!4=2
"Wimp_GetIconState",,ScrapBlk%
"DragASprite_Start",&A1,1,ScrapBlk%!28,DragBlk%+8,DragBlk%+24
"Wimp_DragBox",1,DragBlk%
=Drag_Type%=type% :
is not the same as Wimp drag type!
Drag_Win%=window%
Drag_Icon%=icon%
DDrag_Box0x%=box0x% :
window coords of bottomleft corner of box
Drag_Box0y%=box0y%
,Drag_BoxSizex%=
(DragBlk%!16-DragBlk%!8)
-Drag_BoxSizey%=
(DragBlk%!20-DragBlk%!12)
"Wimp_GetPointerInfo",,PtrInfo%
Drag_Ptrx%=PtrInfo%!0
Drag_Ptry%=PtrInfo%!4
abortdrag
DragASprite%
(Drag_Type%=4)
"DragASprite_Stop"
"Wimp_DragBox",,-1
setmouseshape(0) :
restore default pointer shape
Drag_Type%=7
restore work area size
WinBlk%!0=Drag_Win%
"Wimp_GetWindowState",,WinBlk%
WinBlk%!52=Drag_WAmaxX%
WinBlk%!48=Drag_WAminY%
* Drag_Win%=
redefinewindow(WinBlk%,
Drag_Type%=-1
startwindowmove(window%)
DragBlk%!0=window%
DragBlk%!4=1
initdrag(5,-1,-1,0,0)
startwindowresize(window%)
DragBlk%!0=window%
DragBlk%!4=2
initdrag(6,-1,-1,0,0)
startworkarearesize(window%)
WinBlk%!0=window%
"Wimp_GetWindowInfo",,WinBlk%
LDrag_WAmaxX%=WinBlk%!52 :
save, so it can be restored when drag aborts
Drag_WAminY%=WinBlk%!48
BWinBlk%!52=2000 :
temporarily make work area very large, so
NWinBlk%!48=-2000 :
window-resize drag that follows is not confined by it
&window%=
redefinewindow(WinBlk%,
setcaret(window%,-1)
DragBlk%!0=window%
DragBlk%!4=2
initdrag(7,window%,-1,0,0)
starticondrag(button%,window%,icon%)
button%
1,256
sel_get(window%)
NrSelected%>0
$&
starticonresize(window%,-1)
%
&6
icon%>=0
starticonresize(window%,icon%)
'
4,1024
sel_get(window%)
NrSelected%>0
+$
starticonmove(window%,-1)
,
-4
icon%>=0
starticonmove(window%,icon%)
.
starticonmove(window%,icon%)
win0x%,win0y%,xmin%,xmax%,ymin%,ymax%
WinBlk%!0=window%
"Wimp_GetWindowState",,WinBlk%
win0x%=WinBlk%!4-WinBlk%!20
7 win0y%=WinBlk%!16-WinBlk%!24
icon%>=0
96 SelBlk%!0=icon% :
simulate selection of 1 icon
NrSelected%=1
sel_get(window%)
sel_box(window%,xmin%,ymin%,xmax%,ymax%)
"Wimp_GetPointerInfo",,PtrInfo%
DragBlk%!4=5
DragBlk%!8=xmin%+win0x%
DragBlk%!12=ymin%+win0y%
DragBlk%!16=xmax%+win0x%
DragBlk%!20=ymax%+win0y%
E%DragBlk%!24=DragBlk%!8-PtrInfo%!0
F&DragBlk%!28=DragBlk%!12-PtrInfo%!4
G4DragBlk%!32=ScreenSize_X%+DragBlk%!16-PtrInfo%!0
H4DragBlk%!36=ScreenSize_Y%+DragBlk%!20-PtrInfo%!4
initdrag(0,window%,icon%,xmin%,ymin%)
setmouseshape(1)
starticonresize(window%,icon%)
ibxmin%,ibxmax%,ibymin%,ibymax%
pbxmin%,pbxmax%,pbymin%,pbymax%
a,b,c
ibsizex%,ibsizey%,minsizex%,minsizey%
shape%
win0x%,win0y%,xmin%,xmax%,ymin%,ymax%
WinBlk%!0=window%
"Wimp_GetWindowState",,WinBlk%
win0x%=WinBlk%!4-WinBlk%!20
W win0y%=WinBlk%!16-WinBlk%!24
icon%>=0
Y6 SelBlk%!0=icon% :
simulate selection of 1 icon
NrSelected%=1
sel_get(window%)
sel_box(window%,xmin%,ymin%,xmax%,ymax%)
_Fibxmin%=win0x%+xmin% :
for initial box, convert to screen coords
ibymin%=win0y%+ymin%
ibxmax%=win0x%+xmax%
ibymax%=win0y%+ymax%
ibsizex%=xmax%-xmin%
ibsizey%=ymax%-ymin%
at first, set parent box equal to initial box
pbxmin%=ibxmin%
pbymin%=ibymin%
pbxmax%=ibxmax%
pbymax%=ibymax%
fixed minimum size of drag box (very difficult to calculate!)
minsizex%=4
minsizey%=4
minsizex%>ibsizex%
minsizex%=ibsizex%
minsizey%>ibsizey%
minsizey%=ibsizey%
get position of window on screen
WinBlk%!0=window%
"Wimp_GetWindowState",,WinBlk%
determine which side to drag - test mouse position relative to
diagonals of box
diagonal 1 (bottomleft-topright) y = a*x + b
diagonal 2 (topleft-bottomright) y = -a*x + c
a=ibsizey%/ibsizex%
b=ibymin%-a*ibxmin%
c=ibymax%+a*ibxmin%
"Wimp_GetPointerInfo",,PtrInfo%
PtrInfo%!4>(a*(PtrInfo%!0)+b)
above diagonal 1
PtrInfo%!4>(-a*(PtrInfo%!0)+c)
}*
above diagonal 2 - drag top side
~:
WinBlk%!16>ibymax%
pbymax%=WinBlk%!16-ibsizey%
pbymin%+=minsizey%
shape%=2
?
ibymin%,ibymax% :
top side of box must be "rubber"
+
below diagonal 2 - drag left side
8
WinBlk%!4<ibxmin%
pbxmin%=WinBlk%!4+ibsizex%
pbxmax%-=minsizex%
shape%=5
@
ibxmin%,ibxmax% :
left side of box must be "rubber"
below diagonal 1
PtrInfo%!4>(-a*(PtrInfo%!0)+c)
,
above diagonal 2 - drag right side
1
pbxmax%<WinBlk%!12
pbxmax%=WinBlk%!12
# pbxmin%-=ibsizex%-minsizex%
shape%=3
-
below diagonal 2 - drag bottom side
/
pbymin%>WinBlk%!8
pbymin%=WinBlk%!8
# pbymax%+=ibsizey%-minsizey%
shape%=4
DragBlk%!4=6
DragBlk%!8=ibxmin%
DragBlk%!12=ibymin%
DragBlk%!16=ibxmax%
DragBlk%!20=ibymax%
DragBlk%!24=pbxmin%
DragBlk%!28=pbymin%
DragBlk%!32=pbxmax%
DragBlk%!36=pbymax%
initdrag(1,window%,icon%,xmin%,ymin%)
setmouseshape(shape%)
dragselect(button%)
Drag_Type%<0
"Wimp_GetPointerInfo",,PtrInfo%
DragBlk%!4=6
DragBlk%!8=PtrInfo%!0
DragBlk%!12=PtrInfo%!4
DragBlk%!16=PtrInfo%!0
DragBlk%!20=PtrInfo%!4
WinBlk%!0=PtrInfo%!12
"Wimp_GetWindowState",,WinBlk%
DragBlk%!24=WinBlk%!4
DragBlk%!28=WinBlk%!8
DragBlk%!32=WinBlk%!12
DragBlk%!36=WinBlk%!16
button%=1
E
initdrag(3,PtrInfo%!12,PtrInfo%!16,0,0) :
drag with Adjust
E
initdrag(2,PtrInfo%!12,PtrInfo%!16,0,0) :
drag with Select
startsavedrag(window%)
win0x%,win0y%
WinBlk%!0=window%
"Wimp_GetWindowState",,WinBlk%
win0x%=WinBlk%!4-WinBlk%!20
win0y%=WinBlk%!16-WinBlk%!24
ScrapBlk%!0=window%
ScrapBlk%!4=2
"Wimp_GetIconState",,ScrapBlk%
DragBlk%!4=5
!DragBlk%!8=ScrapBlk%!8+win0x%
#DragBlk%!12=ScrapBlk%!12+win0y%
#DragBlk%!16=ScrapBlk%!16+win0x%
#DragBlk%!20=ScrapBlk%!20+win0y%
"Wimp_GetPointerInfo",,PtrInfo%
%DragBlk%!24=DragBlk%!8-PtrInfo%!0
&DragBlk%!28=DragBlk%!12-PtrInfo%!4
4DragBlk%!32=ScreenSize_X%+DragBlk%!16-PtrInfo%!0
4DragBlk%!36=ScreenSize_Y%+DragBlk%!20-PtrInfo%!4
initdrag(4,window%,2,0,0)
--- move or resize icons, based on new coords of box ---
moveresize(oldwin%,icon%,newwin%,xmin%,ymin%,xmax%,ymax%)
oldxmin%,oldymin%,oldxmax%,oldymax%
xscale,yscale,new%,i%
icon%>=0
6 SelBlk%!0=icon% :
simulate selection of 1 icon
NrSelected%=1
sel_get(oldwin%)
NrSelected%>0
sel_box(oldwin%,oldxmin%,oldymin%,oldxmax%,oldymax%)
calculate scaling factors (will be 1 for move)
. xscale=(xmax%-xmin%)/(oldxmax%-oldxmin%)
. yscale=(ymax%-ymin%)/(oldymax%-oldymin%)
i%=0
NrSelected%-1
IconBlk%!0=oldwin%
! IconBlk%!4=SelBlk%!(4*i%)
(
"Wimp_GetIconState",,IconBlk%
< IconBlk%!8=xmin%+
((IconBlk%!8-oldxmin%)*xscale+0.5)
> IconBlk%!12=ymin%+
((IconBlk%!12-oldymin%)*yscale+0.5)
> IconBlk%!16=xmin%+
((IconBlk%!16-oldxmin%)*xscale+0.5)
> IconBlk%!20=ymin%+
((IconBlk%!20-oldymin%)*yscale+0.5)
oldwin%=newwin%
(
move / resize in same window
= new%=
redefineicon(oldwin%,SelBlk%!(4*i%),IconBlk%)
3
move to other other window = copy icons
IconBlk%!4=newwin%
H
iconrealloc(IconBlk%+24,IconBlk%+28) :
copy indirected data
& new%=
createicon(IconBlk%+4)
*** procs for dialogue and reporting errors ***
errbox(err$,boxes%)
ErrBlk%!0=0
$(ErrBlk%+4)=err$+
"Wimp_ReportError",ErrBlk%,boxes%,Appl$
,click%
=(click%=1)
error(forcequit%)
button%
"Wimp_CloseDown" :
"Hourglass_Smash"
forcequit%
button%=2
button%=3
errbox(
$+" (line "+
)+")",button%))
"Wimp_CloseDown"
complain(msg$)
dummy%
dummy%=
errbox(msg$,17)
dialogue(no%,arg1$)
b1$,b2$,b3$,mask%,xpos%,ypos%
b1$=""
b2$=""
b3$=""
no%
' $Dial_Msg%=
msg_lookup0("MOD0")
b1$=
msg_lookup0("SAVE")
b2$=
msg_lookup0("DCRD")
b3$=
msg_lookup0("CANC")
' $Dial_Msg%=
msg_lookup0("MOD0")
b1$=
msg_lookup0("DALL")
b3$=
msg_lookup0("CANC")
!' $Dial_Msg%=
msg_lookup0("MOD0")
" b1$=
msg_lookup0("LNEW")
# b3$=
msg_lookup0("CANC")
%- $Dial_Msg%=
msg_lookup1("NORM",arg1$)
b2$=
msg_lookup0("OK")
(' $Dial_Msg%=
msg_lookup0("NUPD")
b2$=
msg_lookup0("OK")
+' $Dial_Msg%=
msg_lookup0("NOSH")
b2$=
msg_lookup0("OK")
.' $Dial_Msg%=
msg_lookup0("NOCH")
b2$=
msg_lookup0("OK")
1- $Dial_Msg%=
msg_lookup1("TIDY",arg1$)
b2$=
msg_lookup0("OK")
4' $Dial_Msg%=
msg_lookup0("MOD0")
5 b1$=
msg_lookup0("DCRD")
6 b3$=
msg_lookup0("CANC")
8' $Dial_Msg%=
msg_lookup0("NSEL")
b2$=
msg_lookup0("OK")
;' $Dial_Msg%=
msg_lookup0("NFRM")
b2$=
msg_lookup0("OK")
$Dial_Button1%=b1$
$Dial_Button2%=b2$
$Dial_Button3%=b3$
A)mask%=(1<<2)+(1<<5)+(1<<22)+(&FF<<24)
(b1$)=0
grey colour -> invisible%
seticonstate0(DialW%,1,(1<<22)+(&11<<24),mask%)
seticonstate0(DialW%,1,Dial_ButtonCol1%,mask%)
(b2$)=0
seticonstate0(DialW%,2,(1<<22)+(&11<<24),mask%)
seticonstate0(DialW%,2,Dial_ButtonCol2%,mask%)
(b3$)=0
seticonstate0(DialW%,3,(1<<22)+(&11<<24),mask%)
seticonstate0(DialW%,3,Dial_ButtonCol3%,mask%)
ScrapBlk%!0=DialW%
"Wimp_GetWindowState",,ScrapBlk%
T8xpos%=(ScreenSize_X%-(ScrapBlk%!12-ScrapBlk%!4))
U8ypos%=(ScreenSize_Y%+(ScrapBlk%!16-ScrapBlk%!8))
"Wimp_CreateMenu",,DialW%,xpos%,ypos%
LastDialogue%=no%
*** heap procs ***
heap_init
]>Heap%=
heap starts just after end of allocated memory
"OS_ReadMemMapInfo"
PageSize%
enlarge wimpslot (1 page) and create private heap in new memory
SlotSize%=Heap%-&8000
"Wimp_SlotSize",SlotSize%+PageSize%,-1
SlotSize%
HeapEnd%=SlotSize%+&8000
HeapEnd%<=Heap%
0,"Can't claim space for heap"
"OS_Heap",0,Heap%,,HeapEnd%-Heap%
heap_get(size%)
maxfree%,nrpages%,oldheapend%,ptr%
"OS_Heap",1,Heap%
,,maxfree%
size%>maxfree%
largest free block is too small - try to enlarge wimpslot and heap
lC nrpages%=1+(size%
PageSize%) :
required # pages of memory
"Wimp_SlotSize",SlotSize%+nrpages%*PageSize%,-1
SlotSize%
oldheapend%=HeapEnd%
HeapEnd%=SlotSize%+&8000
"OS_Heap",5,Heap%,,HeapEnd%-oldheapend%
"OS_Heap",1,Heap%
,,maxfree% :
do we have enough now?
size%>maxfree%
complain(
msg_lookup0("NOHP"))
ptr%=-1
"OS_Heap",2,Heap%,,size%
,,ptr%
y =ptr%
heap_release(ptr%)
maxfree%,nrpages%,flg%
"OS_Heap",3,Heap%,ptr%
"OS_Heap",1,Heap%
,,maxfree%
maxfree%>PageSize%
more than 1 page free - try to shrink heap (page by page)
, nrpages%=0 :
# pages of memory freed
1
"XOS_Heap",5,Heap%,,-PageSize%
;flg%
(flg%
1)=0
nrpages%+=1
(flg%
1)<>0
nrpages%>0
4
successfully shrunk heap - shrink WimpSlot
F
"Wimp_SlotSize",SlotSize%-nrpages%*PageSize%,-1
SlotSize%
HeapEnd%=SlotSize%+&8000
"OS_Heap",5,Heap%,,(HeapEnd%-Heap%)-Heap%!12
*** service procs; interface with SWIs, etc. ***
--- change a variable with given difference, but keep inside bounds ---
changevar(
var%,diff%,up%,low%,high%)
oldval%
oldval%=var%
up%
var%+=diff%
var%-=diff%
var%>high%
var%=high%
var%<low%
var%=low%
return TRUE if changed
=(oldval%<>var%)
readvarval(var$)
len%
"OS_ReadVarVal",var$,ScrapBlk%,256,0
,,len%
ScrapBlk%?len%=13
=$(ScrapBlk%)
--- return name of icon to display in browser window ---
windowicon(wflags%,open%)
sname$,tbar%,hscroll%,vscroll%
wflags%
(1<<31)
! tbar%=(wflags%
(1<<26))>0
$ hscroll%=(wflags%
(1<<30))>0
$ vscroll%=(wflags%
(1<<28))>0
tbar%=(wflags%
(1<<0))>0
# hscroll%=(wflags%
(1<<3))>0
# vscroll%=(wflags%
(1<<2))>0
sname$="Swin_"
tbar%
sname$+="t"
hscroll%
sname$+="h"
vscroll%
sname$+="v"
open%
sname$+="o"
=sname$
modevar(mode%,v%)
val%
"OS_ReadModeVariable",mode%,v%
,,val%
=val%
readscreenvars
xeig%,yeig%,xpixels%,ypixels%
xeig%=
modevar(-1,4)
yeig%=
modevar(-1,5)
xpixels%=
modevar(-1,11)
ypixels%=
modevar(-1,12)
9PixToOS_X%=1<<xeig% :
# OS units that 1 pixel takes
PixToOS_Y%=1<<yeig%
EScreenSize_X%=(xpixels%+1)*PixToOS_X% :
screen size in OS units
)ScreenSize_Y%=(ypixels%+1)*PixToOS_Y%
grid size must be multiple of # OS units per pixel
Grid_SizeX%<PixToOS_X%
Grid_SizeX%=PixToOS_X%
- Grid_SizeX%-=(Grid_SizeX%
PixToOS_X%)
Grid_SizeY%<PixToOS_Y%
Grid_SizeY%=PixToOS_Y%
- Grid_SizeY%-=(Grid_SizeY%
PixToOS_Y%)
seticontext(28,
(Grid_SizeX%))
seticontext(29,
(Grid_SizeY%))
Grid_PosX%<PixToOS_X%
Grid_PosX%=PixToOS_X%
+ Grid_PosX%-=(Grid_PosX%
PixToOS_X%)
Grid_PosY%<PixToOS_Y%
Grid_PosY%=PixToOS_Y%
+ Grid_PosY%-=(Grid_PosY%
PixToOS_Y%)
seticontext(30,
(Grid_PosX%))
seticontext(31,
(Grid_PosY%))
DTemplW_MaxCol%=(ScreenSize_X%-100-IcInfo_Width%)
TemplW_IconX%
setcaret(window%,icon%)
icon%>=0
ScrapBlk%!0=window%
ScrapBlk%!4=icon%
"Wimp_GetIconState",,ScrapBlk%
l%=
($(ScrapBlk%!28))
"Wimp_SetCaretPosition",window%,icon%,,,-1,l%
invisible caret
"Wimp_SetCaretPosition",window%,-1,0,0,1<<25
setmouseshape(i%)
n$,xoff%,yoff%
0 :
default pointer shape
n$="ptr_default"
xoff%=0
yoff%=0
1 :
hand pointer for moving icons
n$="ptr_hand"
xoff%=7
yoff%=6
2 :
pointer for resizing icons, dragging top side
n$="ptr_sizet"
xoff%=7
yoff%=6
3 :
pointer for resizing icons, dragging right side
n$="ptr_sizer"
xoff%=5
yoff%=5
4 :
pointer for resizing icons, dragging bottom side
n$="ptr_sizeb"
xoff%=7
yoff%=4
5 :
pointer for resizing icons, dragging left side
n$="ptr_sizel"
xoff%=10
yoff%=5
Mouse_Ptt%!0=&03020100
i%=0
"Wimp_SpriteOp",36,,n$,&2,xoff%,yoff%,0,Mouse_Ptt%
"OS_SpriteOp",&100+36,SysSprites%,n$,&2,xoff%,yoff%,0,Mouse_Ptt%
MouseShape%=i%
--- re-allocate indirected icon data and increase font count ---
iconrealloc(flagptr%,data%)
flags%,s$,s%,len%
flags%=flagptr%!0
(flags%
&800100)=&100
s$=
str(data%!0)
? len%=data%!8 :
don't allocate actual size!
len%>256
len%=256 :
Basic can't handle longer strings
s%=
heap_get(len%)
s%>0
$(s%)=
s$,len%-1)
data%!0=s%
$&
(flags%
(data%!4>0)
%)
re-allocate validation string
s$=
str(data%!4)
s%=
heap_get(
s$+1)
s%>0
$(s%)=s$
data%!4=s%
data%!4=-1
.
0G
allocation failed - make non-indirected and store first chars
1* flagptr%!0=flagptr%!0
(1<<8))
$data%=
s$,11)
(flags%
&800040)=&40
6! FontUsage%((flags%)>>24)+=1
--- release indirected icon data and decrease font count ---
iconrelease(flags%,data%)
(flags%
&800100)=&100
heap_release(data%!0)
(flags%
(data%!(4)<>-1)
?#
release validation string
heap_release(data%!4)
(flags%
&800040)=&40
font_lose(flags%>>24)
--- open a window ---
pos% = 0 -> at current position
1 -> centered to screen
2 -> centered unless already open
3 -> in topleft corner unless already open
4 -> in topright corner unless already open
openwindow(handle%,pos%)
notopen%,cx%,cy%,dx%,dy%
ScrapBlk%!0=handle%
"Wimp_GetWindowState",,ScrapBlk%
R)notopen%=((ScrapBlk%!32
(1<<16))=0)
S dx%=0
T dy%=0
pos%
(pos%=1)
notopen%
X#
center window to screen
cx%=ScreenSize_X%
cy%=ScreenSize_Y%
[0 dx%=cx%-(ScrapBlk%!12+ScrapBlk%!4)
\0 dy%=cy%-(ScrapBlk%!16+ScrapBlk%!8)
]
notopen%
dx%=-ScrapBlk%!4
a( dy%=ScreenSize_Y%-ScrapBlk%!16
b
notopen%
e( dx%=ScreenSize_X%-ScrapBlk%!12
f( dy%=ScreenSize_Y%-ScrapBlk%!16
g
ScrapBlk%!4=ScrapBlk%!4+dx%
ScrapBlk%!8=ScrapBlk%!8+dy%
k!ScrapBlk%!12=ScrapBlk%!12+dx%
l!ScrapBlk%!16=ScrapBlk%!16+dy%
ScrapBlk%!28=-1
"Wimp_OpenWindow",,ScrapBlk%
handle%=OptionsW%
openpane(OptPaneW%,-1,ScrapBlk%!4,ScrapBlk%!16)
closewindow(handle%)
ScrapBlk%!0=handle%
"Wimp_CloseWindow",,ScrapBlk%
handle%
TemplW%
ScrapBlk%!0=IcInfoW%
{(
"Wimp_CloseWindow",,ScrapBlk%
ScrapBlk%!0=PaletteW%
}(
"Wimp_CloseWindow",,ScrapBlk%
NrTemplates%>0
!
i%=0
NrTemplates%-1
closetemplate(i%)
OptionsW%
ScrapBlk%!0=OptPaneW%
(
"Wimp_CloseWindow",,ScrapBlk%
openpane(handle%,behind%,pxmin%,pymax%)
dx%,dy%
handle%
OptPaneW%
A dx%=16 :
distance from topleft corner of parent window
dy%=-16
ScrapBlk%!0=handle%
"Wimp_GetWindowState",,ScrapBlk%
6ScrapBlk%!12=pxmin%+dx%+(ScrapBlk%!12-ScrapBlk%!4)
5ScrapBlk%!8=pymax%+dy%-(ScrapBlk%!16-ScrapBlk%!8)
ScrapBlk%!4=pxmin%+dx%
ScrapBlk%!16=pymax%+dy%
ScrapBlk%!28=behind%
"Wimp_OpenWindow",,ScrapBlk%
opentemplate(no%)
no%>=0
& ScrapBlk%!0=TemplHandle%!(4*no%)
"Wimp_GetWindowState",,ScrapBlk%
(ScrapBlk%!32
(1<<16))=0
ScrapBlk%!28=-1
'
"Wimp_OpenWindow",,ScrapBlk%
< $(TemplNames%+28*no%+14)=
windowicon(ScrapBlk%!32,1)
'
seticonstate0(TemplW%,no%,0,0)
8
TemplatesOpen%=0
PollMask%=PollMask%
TemplatesOpen%+=1
*
setcaret(TemplHandle%!(4*no%),-1)
closetemplate(no%)
no%>=0
& ScrapBlk%!0=TemplHandle%!(4*no%)
"Wimp_GetWindowState",,ScrapBlk%
(ScrapBlk%!32
(1<<16))>0
(
"Wimp_CloseWindow",,ScrapBlk%
+
"Wimp_GetWindowState",,ScrapBlk%
< $(TemplNames%+28*no%+14)=
windowicon(ScrapBlk%!32,0)
'
seticonstate0(TemplW%,no%,0,0)
?
TemplHandle%!(4*no%)=IcEd_Win%
closewindow(IcEdW%)
A
TemplHandle%!(4*no%)=WinEd_Win%
closewindow(WinEdW%)
TemplatesOpen%-=1
4
TemplatesOpen%=0
PollMask%=PollMask%
--- convert string to lowercase ---
locase(s$)
i%=1
a%=
s$,i%,1))
(a%>=65)
(a%<=90)
s$,i%,1)=
(a%+32)
--- convert string to uppercase ---
upcase(s$)
i%=1
a%=
s$,i%,1))
(a%>=97)
(a%<=122)
s$,i%,1)=
(a%-32)
--- split off leaf name from a filename ---
leafname(f$)
p%,q%
p%=q%+1
q%=
f$,".",p%)
q%=0
f$,p%)
--- split off directory name from a filename ---
dirname(f$)
p%,q%
f$,".",p%)
q% > 0
p%=q%+1
q%=0
f$,p%-2)
--- get the control-terminated string at the given address ---
str(s%)
i%,n$
(s%?i%>31)
(i%<255)
n$+=
(s%?i%)
i%+=1
fileexists(f$)
type%
type%=0
(f$)>0
"OS_File",17,f$
type%
=(type%=1)
--- set icon state in a template window ---
seticonstate(window%,icon%,eor%,clr%)
oldflags%,newflags%
ScrapBlk%!0=window%
ScrapBlk%!4=icon%
check if font usage is changing
"Wimp_GetIconState",,ScrapBlk%
oldflags%=ScrapBlk%!24
)newflags%=(oldflags%
clr%)
eor%
(newflags%
&800040)=&40
" FontUsage%(newflags%>>24)+=1
(oldflags%
&800040)=&40
font_lose(oldflags%>>24)
ScrapBlk%!8=eor%
ScrapBlk%!12=clr%
Support%=2
"AEH_SetIconState",,ScrapBlk%
"Wimp_SetIconState",,ScrapBlk%
--- set icon state in one of TemplEd's own windows ---
seticonstate0(window%,icon%,eor%,clr%)
oldflags%,newflags%
ScrapBlk%!0=window%
ScrapBlk%!4=icon%
ScrapBlk%!8=eor%
ScrapBlk%!12=clr%
"Wimp_SetIconState",,ScrapBlk%
selecticon(window%,icon%,f%)
oldflag%
ScrapBlk%!0=window%
ScrapBlk%!4=icon%
"Wimp_GetIconState",,ScrapBlk%
%oldflag%=(ScrapBlk%!24)
(1<<21)
ScrapBlk%!8=1<<21
ScrapBlk%!8=0
ScrapBlk%!12=1<<21
oldflag%<>ScrapBlk%!8
only set when changing
Support%=2
('
"AEH_SetIconState",,ScrapBlk%
*(
"Wimp_SetIconState",,ScrapBlk%
iconselected(window%,icon%)
ScrapBlk%!0=window%
ScrapBlk%!4=icon%
"Wimp_GetIconState",,ScrapBlk%
3#=((ScrapBlk%!24)
(1<<21)) > 0
shadeicon(window%,icon%,f%)
oldflag%
ScrapBlk%!0=window%
ScrapBlk%!4=icon%
"Wimp_GetIconState",,ScrapBlk%
:%oldflag%=(ScrapBlk%!24)
(1<<22)
ScrapBlk%!8=(1<<22)
ScrapBlk%!8=0
ScrapBlk%!12=1<<22
oldflag%<>ScrapBlk%!8
only set when changing
Support%=2
D'
"AEH_SetIconState",,ScrapBlk%
F(
"Wimp_SetIconState",,ScrapBlk%
iconshaded(window%,icon%)
ScrapBlk%!0=window%
ScrapBlk%!4=icon%
"Wimp_GetIconState",,ScrapBlk%
O#=((ScrapBlk%!24)
(1<<22)) > 0
--- store pointer to indirected text icon (for use in PROCseticontext) ---
linkicontext(index%,wbuf%,icon%)
S,IconText%(index%)=wbuf%!(92+icon%*32+20)
T!IconTextWhdl%(index%)=wbuf%!0
IconTextIhdl%(index%)=icon%
seticontext(index%,text$)
$(IconText%(index%))=text$
seticonstate0(IconTextWhdl%(index%),IconTextIhdl%(index%),0,0)
--- store pointer to text of colour-select-box ---
linkcseltext(index%,wbuf%,icon%)
_,CselText%(index%)=wbuf%!(92+icon%*32+20)
`!CselTextWhdl%(index%)=wbuf%!0
CselTextIhdl%(index%)=icon%
--- set colour number in colour-select-box ---
setcolourbox(index%,colour%)
c$,boxcol%
(colour%)
colour%=&FF
c$="--"
$(CselText%(index%))=c$
boxcol%=&07
colour%<16
l2 boxcol%=(colour%<<4)+InverseColour%(colour%)
boxcol%=boxcol%<<24
seticonstate0(CselTextWhdl%(index%),CselTextIhdl%(index%),boxcol%,&FF<<24)
--- change colour number ---
changecolourbox(index%,
colour%,diff%,up%,bigrange%)
newcolour%
up%
newcolour%=colour%+diff%
newcolour%=colour%-diff%
(newcolour%
&FF)=255
newcolour%=newcolour%+diff%
bigrange%
|E newcolour%=newcolour%
&FF :
colours range from 0-255
newcolour%<0
newcolour%=0 :
colours range from 0-15
newcolour%>&F
newcolour%=&F
newcolour%<>colour%
colour%=newcolour%
setcolourbox(index%,colour%)
--- find number of template corresponding with a window handle ---
returns -1 if not a user template, -2 if it's the palette window
whichtemplate(handle%)
(TemplHandle%!(4*i%)<>handle%)
(i%<NrTemplates%)
i%+=1
i%=NrTemplates%
handle%=PaletteW%
i%=-2
; i%=-1 :
handle does not belong to template window
settitlebar(handle%,textptr%,title$)
xmax%,ymax%
$(textptr%)=title$
ScrapBlk%!0=handle%
"Wimp_GetWindowOutline",,ScrapBlk%
xmax%=ScrapBlk%!12
ymax%=ScrapBlk%!16
"Wimp_GetWindowState",,ScrapBlk%
(ScrapBlk%!32
(1<<16))
"Wimp_ForceRedraw",-1,ScrapBlk%!4,ScrapBlk%!16,xmax%,ymax%
--- delete all selected icons in a window ---
deleteiconsel(window%,default%)
sel_get(window%)
NrSelected%>0
i%=0
NrSelected%-1
/
deleteicon(window%,SelBlk%!(4*i%),1,1)
nothing selected - delete icon no. <default%>
default%>=0
deleteicon(window%,default%,1,1)
NrSelected%=0
deleteicon(win%,icon%,release%,adjustvars%)
ScrapBlk%!0=win%
ScrapBlk%!4=icon%
"Wimp_GetIconState",,ScrapBlk%
release%
iconrelease(ScrapBlk%!24,ScrapBlk%+28)
"Wimp_DeleteIcon",,ScrapBlk%
"Wimp_ForceRedraw",win%,ScrapBlk%!8-20,ScrapBlk%!12-20,ScrapBlk%!16+20,ScrapBlk%!20+20
adjustvars%
(win%=IcEd_Win%)
(icon%=IcEd_Icon%)
IcEd_Icon%=-1000
(win%=LastMenu_Win%)
(icon%=LastMenu_Icon%)
LastMenu_Icon%=-1
setchanged(
createicon(blk%)
dxmin%,dymin%,dxmax%,dymax%,handle%
Grid_PosLock%
) dxmin%=
griddiff(blk%!4,Grid_PosX%)
) dymin%=
griddiff(blk%!8,Grid_PosY%)
blk%!4=blk%!4-dxmin%
blk%!8=blk%!8-dymin%
blk%!12=blk%!12-dxmin%
blk%!16=blk%!16-dymin%
Grid_SizeLock%
* dxmin%=
griddiff(blk%!4,Grid_SizeX%)
* dymin%=
griddiff(blk%!8,Grid_SizeY%)
+ dxmax%=
griddiff(blk%!12,Grid_SizeX%)
+ dymax%=
griddiff(blk%!16,Grid_SizeY%)
J dxmin%=
griddiff(blk%!4,PixToOS_X%):
round coords to screen pixels
) dymin%=
griddiff(blk%!8,PixToOS_Y%)
* dxmax%=
griddiff(blk%!12,PixToOS_X%)
* dymax%=
griddiff(blk%!16,PixToOS_Y%)
blk%!4=blk%!4-dxmin%
blk%!8=blk%!8-dymin%
blk%!12=blk%!12-dxmax%
blk%!16=blk%!16-dymax%
blk%!4>=blk%!12
blk%!12=blk%!4+4
blk%!8>=blk%!16
blk%!16=blk%!8+4
"Wimp_CreateIcon",,blk%
handle%
"Wimp_ForceRedraw",blk%!0,blk%!4-12,blk%!8-12,blk%!12+12,blk%!16+12
handle%>MaxIcons%
complain(
msg_lookup0("MICX"))
setchanged(
=handle%
--- calculate distance from nearest gridpoint ---
griddiff(c%,gridsize%)
diff%
diff%=c%
gridsize%
c%<0
(-diff%)>(gridsize%>>1)
diff%+=gridsize%
diff%>(gridsize%>>1)
diff%-=gridsize%
=diff%
--- copy all selected icons in a window ---
copyiconsel(window%,
icon%,dir%)
i%,xmin%,ymin%,xmax%,ymax%,dx%,dy%,handle%
sel_get(window%)
(NrSelected%=0)
(icon%>=0)
SelBlk%!0=icon%
NrSelected%=1
sel_box(window%,xmin%,ymin%,xmax%,ymax%)
dir%
0 : dx%=16 : dy%=-16 :
fixed distance (a bit lower+right)
1 : dx%=0 : dy%=ymax%-ymin% :
copy up
2 : dx%=0 : dy%=ymin%-ymax% :
copy down
3 : dx%=xmin%-xmax% : dy%=0 :
copy left
4 : dx%=xmax%-xmin% : dy%=0 :
copy right
NrSelected%>0
i%=0
NrSelected%-1
copy icon
ScrapBlk%!0=window%
" ScrapBlk%!4=SelBlk%!(4*i%)
)
"Wimp_GetIconState",,ScrapBlk%
ScrapBlk%!4=window%
# ScrapBlk%!8=ScrapBlk%!8+dx%
% ScrapBlk%!12=ScrapBlk%!12+dy%
% ScrapBlk%!16=ScrapBlk%!16+dx%
% ScrapBlk%!20=ScrapBlk%!20+dy%
H
iconrealloc(ScrapBlk%+24,ScrapBlk%+28) :
copy indirected data
( handle%=
createicon(ScrapBlk%+4)
5
deselect originals - copies remain selected
-
selecticon(window%,SelBlk%!(4*i%),0)
icon%>=0
icon%=handle%
sel_get(window%)
--- replace window definition with new one ---
redefinewindow(wbuf%,setchanged%)
oldhandle%,no%,wasopen%,hadcaret%,newhandle%
oldhandle%=wbuf%!0
"Wimp_GetCaretPosition",,ScrapBlk%
&hadcaret%=(ScrapBlk%!0=oldhandle%)
"no%=
whichtemplate(oldhandle%)
ScrapBlk%!0=oldhandle%
"Wimp_GetWindowState",,ScrapBlk%
"%wasopen%=(ScrapBlk%!32)
(1<<16)
"Wimp_DeleteWindow",,wbuf%
"Wimp_CreateWindow",,wbuf%+4
newhandle%
wbuf%!0=newhandle%
no%<>-1
'% TemplHandle%!(4*no%)=newhandle%
oldhandle%=IcEd_Win%
IcEd_Win%=newhandle%
IcEd_Icon%>=0
,3 IcEd_Icon%=-1000 :
invalidate icon handle
oldhandle%=WinEd_Win%
WinEd_Win%=newhandle%
oldhandle%=LastMenu_Win%
LastMenu_Win%=newhandle%
LastMenu_Icon%=-1
wasopen%
"Wimp_OpenWindow",,wbuf%
hadcaret%
"Wimp_SetCaretPosition",newhandle%,-1,0,0,1<<25
:;$(TemplNames%+28*no%+14)=
windowicon(wbuf%!32,wasopen%)
seticonstate0(TemplW%,no%,0,0)
setchanged%
setchanged(
=newhandle%
--- replace icon definition with new one ---
redefineicon(window%,icon%,blk%)
newicon%
deleteicon(window%,icon%,0,0)
new icon data must start at blk%+8 (as returned by Wimp_GetIconState)
blk%!4=window%
E newicon%=
createicon(blk%+4)
(window%=IcEd_Win%)
(icon%=IcEd_Icon%)
IcEd_Icon%=newicon%
(window%=LastMenu_Win%)
(icon%=LastMenu_Icon%)
LastMenu_Icon%=newicon%
=newicon%
--- renumber an icon; new number is equal to NextIconNr% ---
renumbericon(
window%,icon%)
i%,ip1%,ip2%,temp%
WinBlk%!0=window%
"Wimp_GetWindowInfo",,WinBlk%
icon%>=WinBlk%!88
icon%=WinBlk%!88-1
NextIconNr%>=WinBlk%!88
NextIconNr%=WinBlk%!88-1
ip1%=WinBlk%+92+icon%*32
V"ip2%=WinBlk%+92+NextIconNr%*32
swap icon data blocks in window definition
i%=0
temp%=ip1%!i%
ip1%!i%=ip2%!i%
ip2%!i%=temp%
]&window%=
redefinewindow(WinBlk%,1)
--- renumber selected icons, ordering based on topleft coords ---
renumbericonsel(
window%)
i%,j%,f%,l%
sel_get(window%)
sel_sort(window%,1,1,0,0,0,1)
"Wimp_WhichIcon",window%,SelBlk2%,(1<<21)+(1<<23),1<<21
WinBlk%!0=window%
"Wimp_GetWindowInfo",,WinBlk%
hBf%=NextIconNr% :
first number of new numbering
i0l%=NextIconNr%+NrSelected%-1 :
last number
l%>=WinBlk%!88
kK l%=WinBlk%!88-1 :
make sure new numbers are within range
f%=l%-(NrSelected%-1)
i%=0
NrSelected%-1
replace icon with i%-th icon from sorted selection
replaceicon(WinBlk%,f%+i%,window%,SelBlk%!(4*i%))
iconselected(window%,f%+i%)
sM
data of unselected icon overwritten - find new number for this icon
t8
(SelBlk2%!(4*j%)>=f%)
(SelBlk2%!(4*j%)<=l%)
j%+=1
v
w;
replaceicon(WinBlk%,SelBlk2%!(4*j%),window%,f%+i%)
j%+=1
{&window%=
redefinewindow(WinBlk%,1)
NextIconNr%=l%+1
--- set selected icons to same size as topleft icon ---
samesizeiconsel(window%,default%,dim%)
i%,xsize%,ysize%,handle%
sel_get(window%)
(NrSelected%=0)
(default%>=0)
SelBlk%!0=default%
NrSelected%=1
NrSelected%>0
sel_sort(window%,1,1,0,0,0,1)
IconBlk%!0=window%
IconBlk%!4=SelBlk%!0
"Wimp_GetIconState",,IconBlk%
# xsize%=IconBlk%!16-IconBlk%!8
$ ysize%=IconBlk%!20-IconBlk%!12
i%=0
NrSelected%-1
IconBlk%!0=window%
! IconBlk%!4=SelBlk%!(4*i%)
(
"Wimp_GetIconState",,IconBlk%
1
dim%<>2
IconBlk%!16=IconBlk%!8+xsize%
2
dim%<>1
IconBlk%!20=IconBlk%!12+ysize%
> handle%=
redefineicon(window%,SelBlk%!(4*i%),IconBlk%)
--- in wbuf%, replace data for icon ic1% with data of icon ic2% ---
replaceicon(wbuf%,ic1%,window%,ic2%)
ib%,temp1%,temp2%
ib%=wbuf%+92+32*ic1%
?temp1%=ib%!(-8) :
save 2 words just before the icon block
temp2%=ib%!(-4)
ib%!(-8)=window%
ib%!(-4)=ic2%
"Wimp_GetIconState",,ib%-8 :
get icon data block
+ib%!(-8)=temp1% :
restore the 2 words
ib%!(-4)=temp2%
--- update contents of icon info window ---
icinf_update
no%,t$,i$,xmin$,xmax$,ymin$,ymax$,s$,mx%,my%,m$
showicondata%,xmin%,xmax%,ymin%,ymax%
"Wimp_GetPointerInfo",,PtrInfo%
#no%=
whichtemplate(PtrInfo%!12)
t$=""
i$=""
xmin$=""
xmax$=""
ymin$=""
ymax$=""
s$=""
m$=""
showicondata%=
(no%>=0)
t$=$(TemplNames%+28*no%)
PtrInfo%!16>=-1
ScrapBlk%!0=PtrInfo%!12
+
"Wimp_GetWindowState",,ScrapBlk%
1 mx%=PtrInfo%!0-(ScrapBlk%!4-ScrapBlk%!20)
2 my%=PtrInfo%!4-(ScrapBlk%!16-ScrapBlk%!24)
m$=
(mx%)+","+
(my%)
Drag_Type%
K
moving/resizing icon(s) - show current coordinates of dragbox
i$="..."
- xmin%=mx%-(Drag_Ptrx%-DragBlk%!8)
. ymin%=my%-(Drag_Ptry%-DragBlk%!12)
& xmax%=xmin%+Drag_BoxSizex%
& ymax%=ymin%+Drag_BoxSizey%
showicondata%=
D
resizing icon(s) - show current coordinates of dragbox
i$="..."
xmin%=Drag_Box0x%
ymin%=Drag_Box0y%
& xmax%=xmin%+Drag_BoxSizex%
& ymax%=ymin%+Drag_BoxSizey%
MouseShape%
2
2 : ymax%+=(PtrInfo%!4-Drag_Ptry%)
2
3 : xmax%+=(PtrInfo%!0-Drag_Ptrx%)
2
4 : ymin%+=(PtrInfo%!4-Drag_Ptry%)
2
5 : xmin%+=(PtrInfo%!0-Drag_Ptrx%)
showicondata%=
-
show data of icon under pointer
PtrInfo%!16>=0
i$=
(PtrInfo%!16)
% ScrapBlk%!0=PtrInfo%!12
% ScrapBlk%!4=PtrInfo%!16
/
"Wimp_GetIconState",,ScrapBlk%
xmin%=ScrapBlk%!8
xmax%=ScrapBlk%!16
ymin%=ScrapBlk%!12
ymax%=ScrapBlk%!20
showicondata%=
showicondata%
xmin$=
(xmin%)
xmax$=
(xmax%)
ymin$=
(ymin%)
ymax$=
(ymax%)
. s$=
(xmax%-xmin%)+"x"+
(ymax%-ymin%)
t$<>$(IconText%(7))
seticontext(7,t$)
i$<>$(IconText%(8))
seticontext(8,i$)
xmin$<>$(IconText%(9))
seticontext(9,xmin$)
xmax$<>$(IconText%(26))
seticontext(26,xmax$)
ymin$<>$(IconText%(10))
seticontext(10,ymin$)
ymax$<>$(IconText%(27))
seticontext(27,ymax$)
s$<>$(IconText%(11))
seticontext(11,s$)
m$<>$(IconText%(24))
seticontext(24,m$)
alignicons(window%)
move%,imask%,type%,i%,anchorx%,anchory%
dx1%,dx2%,dy1%,dy2%,handle%
"move%=
iconselected(AlignW%,8)
imask%=(31<<16)+(1<<21)
"Wimp_WhichIcon",AlignW%,SelBlk%,imask%,(1<<16)+(1<<21)
type%=SelBlk%!0
sel_get(window%)
NrSelected%>1
type%
.
2,3 :
sel_sort(window%,0,0,1,0,1,1)
.
4 :
sel_sort(window%,0,1,0,0,1,1)
.
5,6 :
sel_sort(window%,1,1,0,1,0,0)
.
7 :
sel_sort(window%,1,0,1,1,1,1)
IconBlk%!0=window%
IconBlk%!4=SelBlk%!0
"Wimp_GetIconState",,IconBlk%
type%
E anchorx%=IconBlk%!8 :
left
G anchorx%=IconBlk%!8+(IconBlk%!16-IconBlk%!8)
2 :
h centre
F anchorx%=IconBlk%!16 :
right
D anchory%=IconBlk%!20 :
G anchory%=IconBlk%!12+(IconBlk%!20-IconBlk%!12)
v centre
G anchory%=IconBlk%!12 :
bottom
i%=1
NrSelected%-1
IconBlk%!0=window%
! IconBlk%!4=SelBlk%!(4*i%)
(
"Wimp_GetIconState",,IconBlk%
dx1%=0
dx2%=0
dy1%=0
dy2%=0
type%
$ dx1%=anchorx%-IconBlk%!8
move%
dx2%=dx1%
"A dx1%=anchorx%-(IconBlk%!8+(IconBlk%!16-IconBlk%!8)
move%
dx2%=dx1%
%% dx2%=anchorx%-IconBlk%!16
move%
dx1%=dx2%
(% dy2%=anchory%-IconBlk%!20
move%
dy1%=dy2%
+C dy1%=anchory%-(IconBlk%!12+(IconBlk%!20-IconBlk%!12)
move%
dy2%=dy1%
.% dy1%=anchory%-IconBlk%!12
move%
dy2%=dy1%
0
1" IconBlk%!8=IconBlk%!8+dx1%
2$ IconBlk%!12=IconBlk%!12+dy1%
3$ IconBlk%!16=IconBlk%!16+dx2%
4$ IconBlk%!20=IconBlk%!20+dy2%
5=
IconBlk%!16<=IconBlk%!8
IconBlk%!16=IconBlk%!8+32
6?
IconBlk%!20<=IconBlk%!12
IconBlk%!20=IconBlk%!12+32
7> handle%=
redefineicon(window%,SelBlk%!(4*i%),IconBlk%)
--- shade the appropriate icons in the Align window
align_shadeicons
iconselected(AlignW%,3)
iconselected(AlignW%,6)
shadeicon(AlignW%,9,1)
shadeicon(AlignW%,9,0)
shadeicon(AlignW%,3,
iconselected(AlignW%,9))
shadeicon(AlignW%,6,
iconselected(AlignW%,9))
spaceicons(window%)
imask%,type%,i%,distance%,space%,ib%,anchor%,dx%,dy%,handle%
I'SpaceOut_Space%=
($(IconText%(18)))
JOimask%=(31<<16)+(1<<21) :
check if spacing must be horizontal or vertical
"Wimp_WhichIcon",SpaceW%,SelBlk%,imask%,(1<<16)+(1<<21)
LBtype%=SelBlk%!0 :
type%=2 => horizontal, type%=3 => vertical
sel_get(window%)
NrSelected%>1
type%=2
P&
sel_sort(window%,0,0,1,0,1,0)
R&
sel_sort(window%,1,0,1,1,1,0)
iconselected(SpaceW%,4)
U! distance%=SpaceOut_Space%
W,
calc available space between icons
WinBlk%!0=window%
Y(
"Wimp_GetWindowInfo",,WinBlk%
Z.
start with space between outer icons
type%=2
\> space%=WinBlk%!(92+32*(SelBlk%!(4*(NrSelected%-1))))
]/ space%-=WinBlk%!(92+32*(SelBlk%!0)+8)
^
_@ space%=WinBlk%!(92+32*(SelBlk%!(4*(NrSelected%-1)))+4)
`0 space%-=WinBlk%!(92+32*(SelBlk%!0)+12)
a
b.
subtract sizes of intermediate icons
NrSelected%>2
d"
i%=1
(NrSelected%-2)
e. ib%=WinBlk%+92+32*(SelBlk%!(4*i%))
type%=2
g# space%-=(ib%!8-ib%!0)
i$ space%-=(ib%!12-ib%!4)
l
m* distance%=space%
(NrSelected%-1)
n4 NrSelected%-=1 :
to avoid moving last icon
IconBlk%!0=window%
IconBlk%!4=SelBlk%!0
"Wimp_GetIconState",,IconBlk%
type%
t!
2 : anchor%=IconBlk%!16
u!
3 : anchor%=IconBlk%!20
i%=1
NrSelected%-1
anchor%+=distance%
IconBlk%!0=window%
z! IconBlk%!4=SelBlk%!(4*i%)
{(
"Wimp_GetIconState",,IconBlk%
dx%=0
dy%=0
type%
&
2 : dx%=anchor%-IconBlk%!8
'
3 : dy%=anchor%-IconBlk%!12
! IconBlk%!8=IconBlk%!8+dx%
# IconBlk%!12=IconBlk%!12+dy%
# IconBlk%!16=IconBlk%!16+dx%
# IconBlk%!20=IconBlk%!20+dy%
type%
#
2 : anchor%=IconBlk%!16
#
3 : anchor%=IconBlk%!20
> handle%=
redefineicon(window%,SelBlk%!(4*i%),IconBlk%)
space_shadeicons
useavail%,i%
&useavail%=
iconselected(SpaceW%,8)
i%=5
shadeicon(SpaceW%,i%,useavail%)
frameicons(window%)
i%,j%,xmin%,ymin%,xmax%,ymax%,handle%,h%,w%
%Frame_IconNo%=
($(IconText%(32)))
$Frame_Space%=
($(IconText%(33)))
&Frame_LabelNo%=
($(IconText%(34)))
(Frame_LeftSpace%=
($(IconText%(35)))
iconselected(FrameW%,5)
Frame_IconNo%=-1
iconselected(FrameW%,15)
Frame_LabelNo%=-1
sel_get(window%)
remove frame and label icon# from selection block
i%=0
NrSelected%-1
icon%=SelBlk%!(4*i%)
SelBlk%!(4*j%)=icon%
(icon%<>Frame_IconNo%)
(icon%<>Frame_LabelNo%)
j%+=1
j%=0
dialogue(10,"")
sel_box(window%,xmin%,ymin%,xmax%,ymax%)
xmin%-=Frame_Space%
ymin%-=Frame_Space%
xmax%+=Frame_Space%
ymax%+=Frame_Space%
Frame_IconNo%=-1
re-open window "around" icons
WinBlk%!0=window%
"Wimp_GetWindowState",,WinBlk%
( WinBlk%!8=WinBlk%!16-(ymax%-ymin%)
( WinBlk%!12=WinBlk%!4+(xmax%-xmin%)
WinBlk%!20=xmin%
WinBlk%!24=ymax%
"Wimp_OpenWindow",,WinBlk%
redefine frame icon
IconBlk%!0=window%
IconBlk%!4=Frame_IconNo%
"Wimp_GetIconState",,IconBlk%
Frame_LabelNo%<>-1
ScrapBlk%!0=window%
" ScrapBlk%!4=Frame_LabelNo%
)
"Wimp_GetIconState",,ScrapBlk%
% w%=(ScrapBlk%!16-ScrapBlk%!8)
& h%=(ScrapBlk%!20-ScrapBlk%!12)
h%=0
IconBlk%!8=xmin%
) IconBlk%!12=ymin%
) IconBlk%!16=xmax%
IconBlk%!20=ymax%+(h%
; handle%=
redefineicon(window%,Frame_IconNo%,IconBlk%)
Frame_LabelNo%<>-1
redefine label icon
IconBlk%!0=window%
! IconBlk%!4=Frame_LabelNo%
(
"Wimp_GetIconState",,IconBlk%
%
iconselected(FrameW%,20)
centered label
) IconBlk%!8=(xmin%+xmax%-w%)
left-spaced label
+ IconBlk%!8=xmin%+Frame_LeftSpace%
IconBlk%!12=ymax%
! IconBlk%!16=IconBlk%!8+w%
" IconBlk%!20=IconBlk%!12+h%
> handle%=
redefineicon(window%,Frame_LabelNo%,IconBlk%)
frame_fillwin
Frame_IconNo%=SelBlk%!0
seticontext(32,
(Frame_IconNo%))
Frame_LabelNo%=SelBlk%!4
seticontext(34,
(Frame_LabelNo%))
frame_shadeicons
frame_shadeicons
f1%,f2%,f3%,i%
f1%=
iconselected(FrameW%,5)
'f2%=f1%
iconselected(FrameW%,15)
'f3%=f2%
iconselected(FrameW%,20)
i%=7
shadeicon(FrameW%,i%,f1%)
shadeicon(FrameW%,15,f1%)
shadeicon(FrameW%,16,f1%)
i%=17
shadeicon(FrameW%,i%,f2%)
i%=22
shadeicon(FrameW%,i%,f3%)
tidyicons(window%,action%)
changed%,xmin%,xmax%,ymin%,ymax%,copy%
ib1%,ib2%,end%,nricons%,dx%,dy%,i%,handle%
WinBlk%!0=window%
"Wimp_GetWindowInfo",,WinBlk%
changed%=0
action%=2
xmin%=WinBlk%!20
ymax%=WinBlk%!24
( xmax%=xmin%+(WinBlk%!12-WinBlk%!4)
( ymin%=ymax%-(WinBlk%!16-WinBlk%!8)
xmin%=WinBlk%!44
ymin%=WinBlk%!48
xmax%=WinBlk%!52
ymax%=WinBlk%!56
WinBlk%!88>0
ib1%=WinBlk%+92
ib2%=ib1%
end%=ib1%+32*(WinBlk%!88)
nricons%=0
ib1%<end%
copy%=
(
change icon coords if required
dx%=0
dy%=0
action%
%
((ib1%!16)
(1<<23))=0
9
test if icon position is within work area
/
ib1%!0<xmin%
dx%=xmin%-ib1%!0
/
ib1%!4<ymin%
dy%=ymin%-ib1%!4
/
ib1%!8>xmax%
dx%=xmax%-ib1%!8
1
ib1%!12>ymax%
dy%=ymax%-ib1%!12
/
(dx%<>0)
(dy%<>0)
changed%+=1
#
((ib1%!16)
(1<<23))
!C ib1%!16=(ib1%!16)
(1<<23) :
reset "deleted" flag
"$
(ib1%!16)
(1<<8)
#B
can't retrieve indirected data - fill in default
$* ib1%!20=
heap_get(ib1%!28)
$(ib1%!20)=""
&&
(ib1%!16)
(1<<0)
ib1%!24=-1
)$ ib1%!24=WinBlk%!68
action%=4
dx%=-100000
dy%=-100000
changed%+=1
3#
((ib1%!16)
(1<<23))
48 copy%=
purge - do not copy data block
changed%+=1
7
copy%
ib1%!0=ib1%!0+dx%
ib1%!4=ib1%!4+dy%
ib1%!8=ib1%!8+dx%
ib1%!12=ib1%!12+dy%
=?
move icon data to new position in window data block
i%=0
ib2%!i%=ib1%!i%
ib2%+=32
nricons%+=1
C
ib1%+=32
changed%=0
dialogue(6,"")
WinBlk%!88=nricons%
J* handle%=
redefinewindow(WinBlk%,1)
K
dialogue(7,
(changed%))
=handle%
setworkarea
xtopleft%,ytopleft%,xsize%,ysize%,xmin%,ymin%
WinBlk%!0=LastMenu_Win%
"Wimp_GetWindowInfo",,WinBlk%
T!xtopleft%=
($(IconText%(12)))
U!ytopleft%=
($(IconText%(13)))
xsize%=
($(IconText%(14)))
ysize%=
($(IconText%(15)))
X%xmin%=
($(IconText%(16)))
&FFFF
Y%ymin%=
($(IconText%(17)))
&FFFF
(xsize%<32)
(ysize%<32)
complain(
msg_lookup0("IWAS"))
xmin%>xsize%
xmin%=xsize%
_!
seticontext(16,
(xmin%))
ymin%>ysize%
ymin%=ysize%
c!
seticontext(17,
(ymin%))
WinBlk%!44=xtopleft%
f! WinBlk%!48=ytopleft%-ysize%
g! WinBlk%!52=xtopleft%+xsize%
WinBlk%!56=ytopleft%
i" WinBlk%!72=(ymin%<<16)+xmin%
j. LastMenu_Win%=
redefinewindow(WinBlk%,1)
centericonsel(window%,default%,dim%)
xmin%,ymin%,xmax%,ymax%,xfree%,yfree%,dx%,dy%,i%,handle%
sel_get(window%)
(NrSelected%=0)
(default%>=0)
SelBlk%!0=default%
NrSelected%=1
NrSelected%>0
sel_box(window%,xmin%,ymin%,xmax%,ymax%)
ScrapBlk%!0=window%
"Wimp_GetWindowState",,ScrapBlk%
y5 xfree%=(ScrapBlk%!12-ScrapBlk%!4)-(xmax%-xmin%)
z) dx%=ScrapBlk%!20+(xfree%
2)-xmin%
{5 yfree%=(ScrapBlk%!16-ScrapBlk%!8)-(ymax%-ymin%)
|) dy%=ScrapBlk%!24-(yfree%
2)-ymax%
dim%=2
dx%=0
dim%=1
dy%=0
i%=0
NrSelected%-1
IconBlk%!0=window%
! IconBlk%!4=SelBlk%!(4*i%)
(
"Wimp_GetIconState",,IconBlk%
! IconBlk%!8=IconBlk%!8+dx%
# IconBlk%!12=IconBlk%!12+dy%
# IconBlk%!16=IconBlk%!16+dx%
# IconBlk%!20=IconBlk%!20+dy%
> handle%=
redefineicon(window%,SelBlk%!(4*i%),IconBlk%)
--- support one of the Wimp extension modules ---
type%=0 -> none
type%=1 -> Interface
type%=2 -> AEH module
type%=3 -> WimpExt
support(type%)
old%,flg%,mod$,module$
old%=Support%
Support%=type%
type%
1 : mod$="Interface" : module$="InterfaceManager"
2 : mod$="AEH" : module$="AEHmodule"
3 : mod$="WimpExt" : module$="WimpExtension"
type%<>0
modulepresent(module$)
Support%=old%
dialogue(3,mod$)
Support%<>old%
deregister previously selected module
old%
"XAEH_Register",-1
+
"XWimpExt_CloseDown",ThisTask%
register newly selected module
type%
"XAEH_Register",1
@
"XWimpExt_Initialise",16,ThisTask%,1+(1<<8)+(1<<10)
redrawall
selecticon(OptPaneW%,9,Support%=1)
selecticon(OptPaneW%,10,Support%=2)
selecticon(OptPaneW%,34,Support%=3)
--- check the presence of a relocatable module ---
modulepresent(rm$)
flg%
"XOS_Module",18,rm$
;flg%
=(flg%
1)=0
--- force the redraw of all open template windows ---
redrawall
NrTemplates%>0
i%=0
(NrTemplates%-1)
" Blk%!0=TemplHandle%!(4*i%)
&
"Wimp_GetWindowState",,Blk%
(Blk%!32
(1<<16))
@
"Wimp_ForceRedraw",-1,Blk%!4,Blk%!8,Blk%!12,Blk%!16
setmainfname(fn$)
MainFname$=fn$
ChangesMade%
fn$+=" *"
settitlebar(TemplW%,TemplTbar%,fn$)
--- set the 'changes made' status ---
setchanged(switch%)
title$
ChangesMade%<>switch%
switch%
! title$=$(TemplTbar%)+" *"
1 title$=
$(TemplTbar%),
($(TemplTbar%))-2)
settitlebar(TemplW%,TemplTbar%,title$)
ChangesMade%=switch%
--- build string with info to send to !Help ---
iconhelp(no%,icon%)
help$,p%
,help$="Template '"+$(TemplNames%+28*no%)
icon%>=0
& help$+="', Icon #"+
(icon%)+"|M"
& ScrapBlk%!0=TemplHandle%!(4*no%)
ScrapBlk%!4=icon%
"Wimp_GetIconState",,ScrapBlk%
flags%=ScrapBlk%!24
(flags%
+
0 : help$+="Non-text, non-sprite"
1 : help$+="Text"
2 : help$+="Sprite"
$
3 : help$+="Text + Sprite"
help$+=" icon, "
(flags%
&100)
= help$+="Indirected (max. size "+
(ScrapBlk%!36)+")|M"
(flags%
ScrapBlk%!32=-1
) help$+="No validation string"
= help$+="Validation string: '"+$(ScrapBlk%!32)+"'"
" help$+="Non-indirected|M "
B help$+="|MButton type: '"+$(IcButton%+20*((flags%>>12)
&F))
, help$+="', ESG: "+
((flags%>>16)
&1F)
OSversion%>=300
J
replace "\" with "\\", else !Help (RiscOS 3) thinks it's a token
p%=
help$,"\")
p%<>0
+ help$=
help$,p%)+"\"+
help$,p%+1)
p%=
help$,"\",p%+2)
$ WinBlk%!0=TemplHandle%!(4*no%)
"Wimp_GetWindowInfo",,WinBlk%
3 help$+="', Window background|MButton type: '"
: help$+=$(WinButton%+20*(((WinBlk%!64)>>12)
&F))+"'"
=help$
--- schedule the closedown of TemplEd ---
prequit
PollMask%=PollMask%
Quit%=
--- send help-request to StrongHelp, for help on a subject ---
askhelp(string$)
Blk%!0=256
Blk%!12=0
Blk%!16=&43B00
&$(Blk%+20)="Help_Word "+string$+
"Wimp_SendMessage",17,Blk%,0
*** procs for saving templates ***
savetemplates(fname$)
handle%,offset%,no%
fname$,".")=0)
(fname$<>"<Wimp$Scrap>")
complain(
msg_lookup0("ISLF"))
"Hourglass_On"
save_init(fname$,NrTemplates%,handle%,offset%)
#handle% :
error(0) :
no%=0
NrTemplates%-1
(?
SavingSelection%)
iconselected(TemplW%,no%))
)-
save_template(no%,handle%,offset%)
*
save_finish(handle%,offset%)
"OS_File",18,fname$,&FEC
"Hourglass_Off"
fname$=MainFname$
setchanged(
QuitAfterSave%
prequit
save_init(fname$,nrtempl%,
handle%,
offset%)
Save_IndexOfs%=16
i%=0
FileIndexSize%-1
FileIndex%?i%=0
set up translation table for font handles -> internal font handles
i%=0
Fra%?i%=0
Save_NrFonts%=0
?2FileIndex%!0=-1 :
no fonts (so far)
@Loffset%=16+nrtempl%*24+4 :
skip first part of file (index saved later)
handle%=
fname$
save_template(no%,handle%,
offset%)
nricons%,i%,dataofs%,ib%
F'FileIndex%!(Save_IndexOfs%)=offset%
G#FileIndex%!(Save_IndexOfs%+8)=1
H9$(FileIndex%+Save_IndexOfs%+12)=$(TemplNames%+28*no%)
I"WinBlk%!0=TemplHandle%!(4*no%)
"Wimp_GetWindowInfo",,WinBlk%
PaneFlag%?no%
L< WinBlk%!32=WinBlk%!32
(1<<5) :
restore 'Pane' flag
nricons%=WinBlk%!88
dataofs%=88+32*nricons%
P6WinBlk%!68=1 :
reset sprite pointer to Wimp area
save_translate(WinBlk%+60,WinBlk%+76,dataofs%)
nricons%>0
i%=0
nricons%-1
ib%=WinBlk%+92+i%*32
U/
save_translate(ib%+16,ib%+20,dataofs%)
Save_Unselected%
W$ ib%!16=ib%!16
(1<<21))
X
"OS_GBPB",1,handle%,WinBlk%+4,88+32*nricons%,offset%
,,,,offset%
"Wimp_GetWindowInfo",,WinBlk%
save_icon(WinBlk%!(60),WinBlk%+76,handle%,offset%)
nricons%>0
i%=0
nricons%-1
`M
save_icon(WinBlk%!(92+i%*32+16),WinBlk%+92+i%*32+20,handle%,offset%)
cEFileIndex%!(Save_IndexOfs%+4)=offset%-FileIndex%!(Save_IndexOfs%)
Save_IndexOfs%+=24
--- translate data in icon block (indirected pointers + font handles) ---
save_translate(flagptr%,data%,
dataofs%)
flags%,sl%,fhandle%,inthandle%
flags%=flagptr%!0
(flags%
(1<<23))>0
icon has been deleted - fill with default data
flagptr%!0=&07800001
$(data%)="<Deleted>"
1. calculate file offset for indirected icon data
(flags%
&100)=&100
(flags%
tL data%!0=dataofs% :
default data for non-text,non-sprite icon
uE dataofs%+=1 :
empty string, 1 char is terminator
data%!4=-1
sl%=
($(data%!0))
data%!0=dataofs%
dataofs%+=sl%+1
{D data%!4=1 :
reset sprite pointer to Wimp area
sl%=
($(data%!0))
data%!0=dataofs%
dataofs%+=sl%+1
data%!4<>-1
sl%=
($(data%!4))
data%!4=dataofs%
dataofs%+=sl%+1
2. translate font handle to internal handle
flags%
(1<<6)
fhandle%=flags%>>24
inthandle%=Fra%?fhandle%
inthandle%=0
Save_NrFonts%+=1
" inthandle%=Save_NrFonts%
" Fra%?fhandle%=inthandle%
8 flagptr%!0=(flags%
&FFFFFF)
(inthandle%<<24)
--- save indirected icon data to file ---
save_icon(flags%,data%,handle%,
offset%)
8ScrapBlk%!0=13 :
temporary buffer for empty string
(flags%
&800100)=&100
flags%
sl%=
($(data%!0))
B
"OS_GBPB",1,handle%,data%!0,sl%+1,offset%
,,,,offset%
flags%
data%!4<>-1
sl%=
($(data%!4))
F
"OS_GBPB",1,handle%,data%!4,sl%+1,offset%
,,,,offset%
7
non-text,non-sprite icon - write empty string
@
"OS_GBPB",1,handle%,ScrapBlk%,1,offset%
,,,,offset%
save_finish(handle%,offset%)
i%,j%
save font data
Save_NrFonts%>0
FileIndex%!0=offset%
i%=1
Save_NrFonts%
/
find font that got internal handle i%
j%=0
Fra%?j%<>i%
j%+=1
E
"Font_ReadDefn",j%,FontData%+8
,,FontData%!0,FontData%!4
A
"OS_GBPB",1,handle%,FontData%,48,offset%
,,,,offset%
save header + index entries
"OS_GBPB",1,handle%,FileIndex%,Save_IndexOfs%+4,0
#handle%
*** procs for loading and deleting user templates ***
templ_add(name$,wblk%,setextent%)
no%,nameptr%,spptr%,i%
NrTemplates%=MaxTemplates%
complain(
msg_lookup0("MTPX"))
no%=NrTemplates%
' PaneFlag%?no%=(wblk%!32)
(1<<5)
# wblk%!32=(wblk%!32)
(1<<5)
"Wimp_CreateWindow",,wblk%+4
TemplHandle%!(4*no%)
NrTemplates%+=1
ScrapBlk%!0=TemplW%
6 ScrapBlk%!4=8+TemplW_IconX%*(no%
TemplW_Cols%)
C ScrapBlk%!12=(ScrapBlk%!4)+(TemplW_IconX%-8)-16*(11-
(name$))
8 ScrapBlk%!16=-8-TemplW_IconY%*(no%
TemplW_Cols%)
2 ScrapBlk%!8=(ScrapBlk%!16)-(TemplW_IconY%-8)
$ ScrapBlk%!20=TemplW_IconFlags%
! nameptr%=TemplNames%+28*no%
$(nameptr%)=name$
ScrapBlk%!24=nameptr%
" spptr%=TemplNames%+28*no%+14
' $(spptr%)=
windowicon(wblk%!32,0)
ScrapBlk%!28=spptr%
ScrapBlk%!32=16
"Wimp_CreateIcon",,ScrapBlk%
DuplNames%
i%=0
&
$(TemplNames%+28*i%)<>name$
i%+=1
$
i%<no%
templ_delete(i%)
setextent%
setextent
seticonstate0(TemplW%,NrTemplates%-1,0,0)
templ_deleteall
"Hourglass_On"
NrTemplates%>0
i%=NrTemplates%-1
templ_delete(i%)
setmainfname("Templates")
setchanged(
"Hourglass_Off"
templ_delete(no%)
i%,j%,wasopen%,oldhandle%
#oldhandle%=TemplHandle%!(4*no%)
WinBlk%!0=oldhandle%
"Wimp_GetWindowInfo",,WinBlk%
iconrelease(WinBlk%!60,WinBlk%+76)
WinBlk%!88>0
i%=0
(WinBlk%!88-1)
?
iconrelease(WinBlk%!(92+i%*32+16),WinBlk%+92+i%*32+20)
"Wimp_DeleteWindow",,WinBlk%
update browser window
WinBlk%!0=TemplW%
"Wimp_GetWindowInfo",,WinBlk%
#wasopen%=(WinBlk%!32)
(1<<16)
no%<(NrTemplates%-1)
move data for icons after the one that is deleted
i%=no%
NrTemplates%-2
ib%=WinBlk%+92+32*i%
j%=0
ib%!j%=ib%!(j%+32)
3 TemplHandle%!(4*i%)=TemplHandle%!(4*(i%+1))
5 $(TemplNames%+28*i%)=$(TemplNames%+28*(i%+1))
; $(TemplNames%+28*i%+14)=$(TemplNames%+28*(i%+1)+14)
% PaneFlag%?i%=PaneFlag%?(i%+1)
WinBlk%!88=WinBlk%!88-1
"Wimp_DeleteWindow",,WinBlk%
"Wimp_CreateWindow",,WinBlk%+4
TemplW%
NrTemplates%-=1
setchanged(NrTemplates%>0)
redefinebrowser(
wasopen%
WinBlk%!0=TemplW%
"Wimp_GetWindowInfo",,WinBlk%
"Wimp_OpenWindow",,WinBlk%
oldhandle%=IcEd_Win%
closewindow(IcEdW%)
oldhandle%=WinEd_Win%
closewindow(WinEdW%)
oldhandle%=LastMenu_Win%
LastMenu_Win%=-1
NrTemplates%=0
closewindow(StatW%)
--- adapt extent of browser window to number of templates ---
setextent
nrrows%,xsize%,titlesize%
"/nrrows%=1+((NrTemplates%-1)
TemplW_Cols%)
nrrows%<2
nrrows%=2
NrTemplates%=0
xsize%=8+TemplW_IconX%
NrTemplates% < TemplW_MaxCol%
(+ xsize%=8+NrTemplates%*TemplW_IconX%
*- xsize%=8+TemplW_MaxCol%*TemplW_IconX%
-&titlesize%=128+16*
($(TemplTbar%))
xsize%<titlesize%
xsize%=titlesize%
ScrapBlk%!0=0
0(ScrapBlk%!4=-8-TemplW_IconY%*nrrows%
ScrapBlk%!8=xsize%
ScrapBlk%!12=0
"Wimp_SetExtent",TemplW%,ScrapBlk%
--- move icons in browser window to adapt to new window size ---
redefinebrowser(reopen%)
wasopen%,i%,ib%,xsize%,ysize%
WinBlk%!0=TemplW%
"Wimp_GetWindowInfo",,WinBlk%
;(wasopen%=((WinBlk%!32)
(1<<16))<>0
WinBlk%!88>0
i%=0
(WinBlk%!88-1)
ib%=WinBlk%+92+32*i%
?@ xsize%=(TemplW_IconX%-8)-16*(11-
($(TemplNames%+i%*28)))
ysize%=ib%!12-ib%!4
A1 ib%!0=8+TemplW_IconX%*(i%
TemplW_Cols%)
ib%!8=(ib%!0)+xsize%
C3 ib%!12=-8-TemplW_IconY%*(i%
TemplW_Cols%)
ib%!4=(ib%!12)-ysize%
"Wimp_DeleteWindow",,WinBlk%
"Wimp_CreateWindow",,WinBlk%+4
TemplW%
setextent
reopen%
wasopen%
WinBlk%!0=TemplW%
"Wimp_GetWindowInfo",,WinBlk%
adapt scroll offsets if visible area exceeds work area
(WinBlk%!20+(WinBlk%!12-WinBlk%!4))>WinBlk%!52
O4 WinBlk%!20=WinBlk%!52-(WinBlk%!12-WinBlk%!4)
WinBlk%!20<0
Q* WinBlk%!12=WinBlk%!12+WinBlk%!20
WinBlk%!20=0
S
(WinBlk%!24-(WinBlk%!16-WinBlk%!8))<WinBlk%!48
V4 WinBlk%!24=WinBlk%!48+(WinBlk%!16-WinBlk%!8)
WinBlk%!24>0
X( WinBlk%!8=WinBlk%!8+WinBlk%!24
WinBlk%!20=0
Z
"Wimp_OpenWindow",,WinBlk%
templ_loadfile(fname$,loadsprites%)
i%,nr%,name$,handle%,ip%,indirbuf%,sname$
"Hourglass_On"
"Hourglass_LEDs",1
i%=0
FontUsage%(i%)>0
fK
font in use - make for extra call to Font_LoseFont at end of proc
Fra%?i%=1
Fra%?i%=0
NrTemplates%=0
fname$="<Wimp$Scrap>"
n#
setmainfname(NewLeafName$)
setmainfname(fname$)
loadsprites%
leafname(fname$)="Templates")
t3 sname$=
dirname(fname$)+".Sprites"+SprSuffix$
fileexists(sname$)
v
loadusersprites(sname$)
x* sname$=
dirname(fname$)+".Sprites"
y2
(SprSuffix$<>"")
fileexists(sname$)
z"
loadusersprites(sname$)
{
~&indirbuf%=
heap_get(MaxIndirSize%)
indirbuf%>0
handle%=
fname$
handle%>0
F
read index of template file to check for oversized templates
:
"OS_GBPB",3,handle%,FileIndex%,FileIndexSize%,0
#handle%
&
"Wimp_OpenTemplate",,fname$
ip%=FileIndex%+24
nr%=0
$
ip%!0>MaxTemplateSize%
5
complain(
msg_lookup1("TTLB",$(ip%+12)))
:
templ_load(nr%,name$,indirbuf%,MaxIndirSize%)
nr%>0
)
templ_add(name$,WinBlk%,0)
ip%+=24
1
(nr%<=0)
(NrTemplates%=MaxTemplates%)
"Wimp_CloseTemplate"
!
fname$="<Wimp$Scrap>"
H
"OS_File",6,fname$ :
delete Wimp$Scrap file after reading
heap_release(indirbuf%)
setextent
i%=0
neutralise calls of Font_FindFont done by Wimp_LoadTemplate
Fra%?i%>1
"Font_LoseFont",i%
Fra%?i%-=1
"Hourglass_Off"
openwindow(TemplW%,3)
IcInfo_Active%
openwindow(IcInfoW%,4)
templ_load(
nr%,
n$,p%,psize%)
dx%,dy%,icon%,tb%,ib%
"Wimp_CloseTemplate" :
error(0) : nr%=0 :
-n$="*"+
0) :
name length must be 12
"Wimp_LoadTemplate",,WinBlk%+4,p%,p%+psize%,Fra%,n$,nr%
,,,,,n$,nr%
nr%>0
make sure window origin position is within current screen size
dx%=0
dy%=0
WinBlk%!4<0
dx%=-WinBlk%!4
WinBlk%!8<0
dy%=-WinBlk%!8
WinBlk%!12>ScreenSize_X%
dx%=ScreenSize_X%-WinBlk%!12
WinBlk%!16>(ScreenSize_Y%-TBarHeight%)
0 dy%=ScreenSize_Y%-TBarHeight%-WinBlk%!16
WinBlk%!4=WinBlk%!4+dx%
WinBlk%!8=WinBlk%!8+dy%
WinBlk%!12=WinBlk%!12+dx%
WinBlk%!16=WinBlk%!16+dy%
? WinBlk%!68=UserSprites% :
set sprite area (CBP pointer)
re-allocate indirected data, each field in a separate heap block
WinBlk%!32
(1<<31)
tb%=WinBlk%!32
(1<<26)
tb%=WinBlk%!32
(1<<0)
tb%
F
iconrealloc(WinBlk%+60,WinBlk%+76) :
realloc title bar icon
?
icon_setspritearea(WinBlk%!60,WinBlk%+76,UserSprites%)
.
no title bar: fill data with default
WinBlk%!60=&3D
" $(WinBlk%+76)="<Untitled>"
(WinBlk%!88)>0
"
icon%=0
(WinBlk%!88)-1
! ib%=WinBlk%+92+icon%*32
%
iconrealloc(ib%+16,ib%+20)
>
set sprite pointers (indirected sprite-only icons)
9
icon_setspritearea(ib%!16,ib%+20,UserSprites%)
icon%
--- sort templates on names (case-insensitive) ---
templ_sort
i%,j%,index%,candidate%,candname$,name$
,i%=0 :
first <i%> templates are sorted
i%<(NrTemplates%-1)
find template with lowest name
candidate%=i%
- candname$=
upcase($(TemplNames%+i%*28))
j%=i%+1
(NrTemplates%-1)
+ name$=
upcase($(TemplNames%+j%*28))
name$<candname$
candidate%=j%
candname$=name$
swap template data
j%=0
(28-4)
@
TemplNames%!(i%*28+j%),TemplNames%!(candidate%*28+j%)
TemplHandle%!(4*i%),TemplHandle%!(4*candidate%)
PaneFlag%?i%,PaneFlag%?candidate%
i%+=1
*** procs for reading and sorting selections ***
--- get list of selected icons and count them ---
sel_get(window%)
"Wimp_WhichIcon",window%,SelBlk%,(1<<21)+(1<<23),1<<21
NrSelected%=0
SelBlk%!(4*NrSelected%)<>-1
NrSelected%+=1
--- select all icons ---
sel_all(window%)
get all icons that are not selected nor deleted
"Wimp_WhichIcon",window%,SelBlk%,(1<<21)+(1<<23),0
SelBlk%!i%<>-1
selecticon(window%,SelBlk%!i%,1)
i%+=4
--- unselect all icons (except, maybe, for one icon) ---
sel_clear(window%,except%)
"Wimp_WhichIcon",window%,SelBlk%,1<<21,1<<21
SelBlk%!i%<>-1
SelBlk%!i%<>except%
selecticon(window%,SelBlk%!i%,0)
i%+=4
NrSelected%=0
--- sort icon selection (assumes selection present in SelBlk%) ---
sel_sort(window%,key1%,max1%,dir1%,key2%,max2%,dir2%)
if key=0 then sort on horizontal coordinates, else vertical
if max=0 then sort on minimum coordinates, else maximum
if dir=0 then sort in descending order, else ascending
i%,j%,index1%,index2%,ib%
value1%,value2%,candidate%,bestsofar1%,bestsofar2%,better%
5i%=0 :
first <i%> icons in selection are sorted
key1%=0
index1%=0
index1%=4
max1%
index1%+=8
key2%=0
index2%=0
index2%=4
max2%
index2%+=8
WinBlk%!0=window%
"Wimp_GetWindowInfo",,WinBlk%
i%<(NrSelected%-1)
find icon with smallest/highest value for coordinate
candidate%=i%
*( ib%=WinBlk%+92+32*(SelBlk%!(4*i%))
bestsofar1%=ib%!(index1%)
bestsofar2%=ib%!(index2%)
j%=i%+1
(NrSelected%-1)
.* ib%=WinBlk%+92+32*(SelBlk%!(4*j%))
value1%=ib%!(index1%)
value2%=ib%!(index2%)
bestsofar1%=value1%
2#
look at second sort key
dir2%
4) better%=(value2%<bestsofar2%)
6) better%=(value2%>bestsofar2%)
8
dir1%
:F better%=(value1%<bestsofar1%) :
looking for lowest value
<G better%=(value1%>bestsofar1%) :
looking for highest value
>
better%
candidate%=j%
bestsofar1%=value1%
bestsofar2%=value2%
C
swap icons in selection sequence
SelBlk%!(4*candidate%),SelBlk%!(4*i%)
i%+=1
--- calculate coords of box surrounding selected icons ---
sel_box(window%,
xmin%,
ymin%,
xmax%,
ymax%)
assume selection present in SelBlk%
ScrapBlk%!0=window%
ScrapBlk%!4=SelBlk%!0
"Wimp_GetIconState",,ScrapBlk%
xmin%=ScrapBlk%!8
ymin%=ScrapBlk%!12
xmax%=ScrapBlk%!16
ymax%=ScrapBlk%!20
i%=0
NrSelected%-1
W ScrapBlk%!4=SelBlk%!(4*i%)
"Wimp_GetIconState",,ScrapBlk%
xmin%>ScrapBlk%!8
xmin%=ScrapBlk%!8
ymin%>ScrapBlk%!12
ymin%=ScrapBlk%!12
xmax%<ScrapBlk%!16
xmax%=ScrapBlk%!16
ymax%<ScrapBlk%!20
ymax%=ScrapBlk%!20
*** setup procs ***
setup_default
IcInfo_Active%=
DuplNames%=
Hatch%=
Setup_Support%=0
Grid_SizeLock%=
Grid_SizeX%=2
Grid_SizeY%=4
Grid_PosLock%=
Grid_PosX%=2
Grid_PosY%=4
Save_Unselected%=
DeleteOutside%=
TrapDclick%=
Stats_Decimal%=
IgnoreDeskFont%=
export_settype(2)
setup_load
f%,etype%
(ApplDir$+".Options")
f%=0
setup_default
#f% :
error(0) :
setup_default :
#f%,IcInfo_Active%,DuplNames%,Hatch%,Setup_Support%
#f%,Grid_SizeLock%,Grid_SizeX%,Grid_SizeY%
#f%,Grid_PosLock%,Grid_PosX%,Grid_PosY%
#f%,Save_Unselected%,DeleteOutside%,TrapDclick%,Stats_Decimal%
#f%,IgnoreDeskFont%,etype%
export_settype(etype%)
setup_save
(ApplDir$+".Options")
f%<>0
#f% :
error(0) :
#f%,IcInfo_Active%,DuplNames%,Hatch%,Support%
#f%,Grid_SizeLock%,Grid_SizeX%,Grid_SizeY%
#f%,Grid_PosLock%,Grid_PosX%,Grid_PosY%
#f%,Save_Unselected%,DeleteOutside%,TrapDclick%,Stats_Decimal%
#f%,IgnoreDeskFont%,ExportType%
*** procs for statistics window ***
stat_fillwin
wasopen%,ysize%,maxwdef%,totindsize%,i%,wdef%,indsize%,j%,ib%
"Hourglass_On"
sel_get(StatW%)
SelBlk%!0=2
( type%=2 :
numbers in hexadecimal
type%=1 :
decimal
WinBlk%!0=StatW%
"Wimp_GetWindowInfo",,WinBlk%
#wasopen%=(WinBlk%!32)
(1<<16)
"Wimp_DeleteWindow",,WinBlk%
WinBlk%!88=15
-ysize%=204+NrTemplates%*40 :
set extent
*WinBlk%!8=WinBlk%!16-WinBlk%!24-ysize%
WinBlk%!48=-ysize%
"Wimp_CreateWindow",,WinBlk%+4
StatW%
WinBlk%!0=StatW%
linkicontext(25,WinBlk%,5) :
number of templates
linkicontext(22,WinBlk%,7) :
largest window definition
linkicontext(23,WinBlk%,9) :
total size of indirected data
maxwdef%=0
totindsize%=0
i%=0
NrTemplates%-1
# WinBlk%!0=TemplHandle%!(4*i%)
"Wimp_GetWindowInfo",,WinBlk%
wdef%=88+32*WinBlk%!88
9 indsize%=
stat_calcindirsize(WinBlk%!60,WinBlk%+76)
WinBlk%!88>0
j%=0
(WinBlk%!88-1)
ib%=WinBlk%+92+32*j%
6 indsize%+=
stat_calcindirsize(ib%!16,ib%+20)
stat_createicon(10,$(TemplNames%+i%*28),i%)
stat_createicon(11,
stat_num2str(WinBlk%!88),i%)
stat_createicon(12,
stat_num2str(wdef%),i%)
stat_createicon(13,
stat_num2str(indsize%),i%)
stat_createicon(14,
stat_num2str(wdef%+indsize%),i%)
wdef%+=indsize%
maxwdef%<wdef%
maxwdef%=wdef%
totindsize%+=indsize%
seticontext(25,
(NrTemplates%))
seticontext(22,
stat_num2str(maxwdef%))
seticontext(23,
stat_num2str(totindsize%))
wasopen%
openwindow(StatW%,0)
openwindow(StatW%,1)
"Hourglass_Off"
--- calculate size of indirected data needed for an icon ---
stat_calcindirsize(flags%,data%)
size%
(flags%
&800100)=&100
size%=data%!8
(flags%
(data%!4<>-1)
# size%=size%+
($(data%!4))+1
size%=0
=size%
--- create an icon in the stats window ---
stat_createicon(copyfrom%,s$,line%)
ScrapBlk%!0=StatW%
ScrapBlk%!4=copyfrom%
"Wimp_GetIconState",,ScrapBlk%
create icon that is identical, except for string, colours and Y coord
,ScrapBlk%!12=ScrapBlk%!12-4-40*(line%+1)
ScrapBlk%!20=ScrapBlk%!12+40
9ScrapBlk%!24=(ScrapBlk%!24
&FFFFFF)
Stat_Colours%
HScrapBlk%!24=ScrapBlk%!24
&100) :
icon must be not-indirected
$(ScrapBlk%+28)=s$
ScrapBlk%!4=StatW%
"Wimp_CreateIcon",,ScrapBlk%+4
--- convert a number to a string (hex or decimal) ---
stat_num2str(num%)
Stats_Decimal%
s$=
(num%)
s$="&"+
~(num%)
*** procs for handling outline fonts ***
font_lose(font%)
FontUsage%(font%)-=1
FontUsage%(font%)=0
"Font_LoseFont",font%
font_loseall
i%,j%
i%=0
FontUsage%(i%)<>0
"Font_LoseFont",i%
--- get font name and size from a font handle ---
font_getinfo(fhandle%,
name$,
xsize,
ysize)
xsize16%,ysize16%
"Font_ReadDefn",fhandle%,FontData%
,,xsize16%,ysize16%
name$=$(FontData%)
xsize=xsize16%/16
ysize=ysize16%/16
*** procs for calculating & setting the minimum size of an icon ***
minimizeiconsel(window%,default%,dim%)
i%,xsize%,ysize%,handle%
sel_get(window%)
(NrSelected%=0)
(default%>=0)
SelBlk%!0=default%
NrSelected%=1
NrSelected%>0
i%=0
NrSelected%-1
:
miniconsize(window%,SelBlk%!(4*i%),xsize%,ysize%)
IconBlk%!0=window%
! IconBlk%!4=SelBlk%!(4*i%)
(
"Wimp_GetIconState",,IconBlk%
1
dim%<>2
IconBlk%!16=IconBlk%!8+xsize%
2
dim%<>1
IconBlk%!20=IconBlk%!12+ysize%
> handle%=
redefineicon(window%,SelBlk%!(4*i%),IconBlk%)
miniconsize(window%,icon%,
minx%,
miny%)
sparea%,flags%,data%,text%,sprite%,indir%
sminx%,sminy%,tminx%,tminy%,p%,val$,sname$,t$
xmin%,ymin%,xmax%,ymax%
l$,lspace%,lines%,b$
WinBlk%!0=window%
"Wimp_GetWindowInfo",,WinBlk%
sparea%=WinBlk%!68
ScrapBlk%!0=window%
ScrapBlk%!4=icon%
"Wimp_GetIconState",,ScrapBlk%
flags%=ScrapBlk%!24
data%=ScrapBlk%+28
text%=(flags%
1)>0
sprite%=(flags%
2)>0
indir%=(flags%
&100)>0
indir%
text%
(data%!4<>-1)
val$=$(data%!4)
sprite%
indir%
text%
:4
search validation string for sprite name
;- sname$=
validationcommand(val$,"S")
p%=
sname$,",")
p%>0
>" sname$=
sname$,2,p%-2)
sname$=
sname$,2)
B
sname$=$(data%!0)
sparea%=data%!4
E
sname$=$(data%)
(sname$)>0
spritesize(sname$,sparea%,sminx%,sminy%)
text%
indir%
t$=$(data%!0)
t$=$(data%)
flags%
(1<<6)
R5
calc size of string printed as outline font
S&
"Font_SetFont",(flags%>>24)
T;
"Font_StringBBox",,t$
,xmin%,ymin%,xmax%,ymax%
UG
"Font_ConverttoOS",,xmax%-xmin%,ymax%-ymin%
,tminx%,tminy%
tminx%+=2*PixToOS_X%
tminy%+=2*PixToOS_Y%
Y.
(OSversion%<350)
IgnoreDeskFont%
Z'
calc text width in BBC font
tminx%=16*
(t$)+4
\
]3
calc text width in current desktop font
^(
"Wimp_TextOp",1,t$
tminx%
tminx%+=8
`
a- tminy%=32 :
text height fixed to 32
c% l$=
validationcommand(val$,"L")
(l$)>0
e5
multi-line text - calc Y size, X size fixed
lspace%=
l$,2))
g
lspace%=0
lspace%=40
h6 lines%=(tminx%-1)
(ScrapBlk%!16-ScrapBlk%!8)
i' tminx%=ScrapBlk%!16-ScrapBlk%!8
j! tminy%=lspace%*(lines%+1)
flags%
(1<<4)
minx%=sminx%+tminx%
minx%=0
p> minx%=ScrapBlk%!16-ScrapBlk%!8 :
don't change X size
r$
text%
sprite%
minx%+=6
s5
sminy%>tminy%
miny%=sminy%
miny%=tminy%
sminx%>tminx%
minx%=sminx%
minx%=tminx%
miny%=sminy%+tminy%
flags%
(1<<2)
add space taken by border
{% b$=
validationcommand(val$,"R")
(b$)=0
}7 minx%+=16 :
no border command - "flat" border
miny%+=16
&
found command for 3-D border
b$,2))
minx%+=24
miny%+=24
minx%+=32
miny%+=32
minx%+=16
miny%+=16
minx%<16
minx%=16
miny%<16
miny%=16
--- return size of a sprite in OS units ---
spritesize(name$,area%,
xsize%,
ysize%)
spmode%,xpixels%,ypixels%
area%=1
"XWimp_SpriteOp",40,,name$
,,,xpixels%,ypixels%,,spmode%;flg%
"XOS_SpriteOp",296,area%,name$
,,,xpixels%,ypixels%,,spmode%;flg%
(flg%
9
sprite not found in custom area - try wimp area
J
"XWimp_SpriteOp",40,,name$
,,,xpixels%,ypixels%,,spmode%;flg%
(flg%
xsize%=0
ysize%=0
* xsize%=xpixels%<<
modevar(spmode%,4)
* ysize%=ypixels%<<
modevar(spmode%,5)
--- search validation string for a certain command and return it ---
validationcommand(v$,cmd$)
upc$,loc$,p%
upc$=
(cmd$)
&DF)
loc$=
(cmd$)
&20)
v$,1)<>upc$)
v$,1)<>loc$)
(v$)>0)
p%=
v$,";")
(p%>1)
v$,p%-1,1)="\")
v$,";",p%+1)
p%=0
v$=""
v$=
v$,p%+1)
v$,";")
p%>0
v$,p%-1)
*** procs for handling messages in the Messages file ***
msg_init
fname$,flags%,size%,buf%
fname$=ApplDir$+".Messages"
"MessageTrans_FileInfo",,fname$
flags%,,size%
flags%
buf%=0
buf%=
heap_get(size%)
$MsgDesc%=
heap_get(17+
(fname$))
$(MsgDesc%+16)=fname$
"MessageTrans_OpenFile",MsgDesc%,MsgDesc%+16,buf%
msg_exit
"MessageTrans_CloseFile",MsgDesc%
MsgDesc%=0
msg_lookup0(token$)
result$
"MessageTrans_Lookup",MsgDesc%,token$,0
,,result$
=result$
msg_lookup1(token$,param$)
result$
"MessageTrans_Lookup",MsgDesc%,token$,ScrapBlk%,&100,param$
,,result$
=result$
msg_lookup2(token$,param1$,param2$)
result$
"MessageTrans_Lookup",MsgDesc%,token$,ScrapBlk%,&100,param1$,param2$
,,result$
=result$
*** procs for loading and using user-sprites ***
--- load a sprite file and let all templates use the sprites
loadusersprites(fname$)
UserSprites%<>1
heap_release(UserSprites%)
modulepresent("OLESupport")
)
"OLE_DeLinkFile",1,ThisTask%,0
fname$=""
UserSprites%=1
* UserSprites%=
loadspritefile(fname$)
NrTemplates%>0
no%=0
NrTemplates%-1
@
window_setspritearea(TemplHandle%!(4*no%),UserSprites%)
UserSprites%=1
SpriteFname$=""
SpriteFname$=fname$
modulepresent("OLESupport")
%
"OLE_SimulateSession",&FF9
,
"OLE_LinkFile",fname$,ThisTask%,0
loadspritefile(fname$)
type%,laddr%,fsize%,ftype%,area%
"OS_File",17,fname$
type%,,laddr%,,fsize%
(laddr%>>20)
&FFF=&FFF
ftype%=(laddr%>>8)
&FFF
ftype%=-1
(type%<>1)
(ftype%<>&FF9)
complain(
msg_lookup1("NOSF",fname$))
area%=1
fsize%+=16
area%=
heap_get(fsize%)
area%>0
area%!0=fsize%
area%!8=16
$
"OS_SpriteOp",256+9,area%
,
"OS_SpriteOp",256+10,area%,fname$
H area%=1 :
couldn't allocate space in heap - reset to Wimp area
=area%
window_setspritearea(handle%,area%)
icon%,ib%
WinBlk%!0=handle%
"Wimp_GetWindowInfo",,WinBlk%
$WinBlk%!68=area% :
CBP pointer
icon_setspritearea(WinBlk%!60,WinBlk%+76,area%)
(WinBlk%!88)>0
icon%=0
(WinBlk%!88)-1
ib%=WinBlk%+92+icon%*32
0
icon_setspritearea(ib%!16,ib%+20,area%)
icon%
"&handle%=
redefinewindow(WinBlk%,0)
icon_setspritearea(flags%,data%,area%)
((flags%
3)=2)
((flags%
&100)<>0)
data%!4=area%
*** procs for exporting templates ***
exporttemplates(fname$)
handle%,no%
fname$,".")=0)
(fname$<>"<Wimp$Scrap>")
complain(
msg_lookup0("ISLF"))
"Hourglass_On"
handle%=
fname$
#handle% :
error(0) :
no%=0
NrTemplates%-1
7?
SavingSelection%)
iconselected(TemplW%,no%))
#handle%,
48,"-")
9<
#handle%,"Template name: "+$(TemplNames%+28*no%)
#handle%,
48,"-")
;'
export_template(no%,handle%)
#handle%,""
=
#handle%
"OS_File",18,fname$,&FFF
"Hourglass_Off"
export_template(no%,handle%)
nricons%,i%,ib%
G"WinBlk%!0=TemplHandle%!(4*no%)
"Wimp_GetWindowInfo",,WinBlk%
#handle%,"Visible area "+
box2str(WinBlk%+4,8)
#handle%,"Work area "+
box2str(WinBlk%+44,8)
#handle%,"Scroll offset "+
rjustify(WinBlk%!20,8)+
rjustify(WinBlk%!24,8)
#handle%,"Minimum size ";
#handle%,
rjustify((WinBlk%!72)
&FFFF,8);
#handle%,
rjustify((WinBlk%!72)>>16,8)
#handle%,"Flags "+
export_wflags(WinBlk%!32,no%)
#handle%,"Button type "+$(WinButton%+20*((WinBlk%!64)>>12))
#handle%,"Colours:"
#handle%," Title fg "+
(WinBlk%?36)
#handle%," Title bg "+
(WinBlk%?37)
#handle%," Work fg "+
(WinBlk%?38)
#handle%," Work bg "+
(WinBlk%?39)
#handle%," Scroll outer "+
(WinBlk%?40)
#handle%," Scroll inner "+
(WinBlk%?41)
#handle%," Input focus "+
(WinBlk%?42)
#handle%,"Title bar:"
export_iconcontents(WinBlk%!60,WinBlk%+76,1)
nricons%=WinBlk%!88
#handle%,"No. of icons "+
(nricons%)
nricons%>0
#handle%,""
i%=0
nricons%-1
`%
#handle%,"Icon #"+
(i%)+":"
ib%=WinBlk%+92+i%*32
b3
#handle%," Position "+
box2str(ib%,8)
c-
export_iconcontents(ib%!16,ib%+20,0)
export_wflags(f%,no%)
(f%
(1<<0))
f$,1,1)="t"
(f%
(1<<1))
f$,2,1)="M"
(f%
(1<<2))
f$,3,1)="v"
(f%
(1<<3))
f$,4,1)="h"
(f%
(1<<4))
f$,5,1)="A"
(PaneFlag%?no%)
f$,6,1)="P"
(f%
(1<<6))
f$,7,1)="N"
(f%
(1<<7))
f$,8,1)="b"
(f%
(1<<8))
f$,9,1)="A"
(f%
(1<<9))
f$,10,1)="1"
(f%
(1<<10))
f$,11,1)="G"
(f%
(1<<11))
f$,12,1)="B"
(f%
(1<<12))
f$,13,1)="H"
(f%
(1<<13))
f$,14,1)="S"
(f%
(1<<14))
f$,15,1)="X"
(f%
(1<<15))
f$,16,1)="Y"
f$,17,8)=
8,"x")
(f%
(1<<24))
f$,25,1)="B"
(f%
(1<<25))
f$,26,1)="C"
(f%
(1<<26))
f$,27,1)="T"
(f%
(1<<27))
f$,28,1)="T"
(f%
(1<<28))
f$,29,1)="V"
(f%
(1<<29))
f$,30,1)="A"
(f%
(1<<30))
f$,31,1)="H"
(f%
(1<<31))
f$,32,1)="N"
export_iconcontents(flags%,data%,tbar%)
f$,t%,s%,i%,fn$,fx%,fy%
(flags%
(1<<23))
#handle%," ** DELETED **"
f$=
(flags%
(1<<0))
f$,1,1)="T"
(flags%
(1<<1))
f$,2,1)="S"
(flags%
(1<<2))
f$,3,1)="B"
(flags%
(1<<3))
f$,4,1)="H"
(flags%
(1<<4))
f$,5,1)="V"
(flags%
(1<<5))
f$,6,1)="F"
(flags%
(1<<6))
f$,7,1)="O"
(flags%
(1<<7))
f$,8,1)="N"
(flags%
(1<<8))
f$,9,1)="I"
(flags%
(1<<9))
f$,10,1)="R"
(flags%
(1<<10))
f$,11,1)="A"
(flags%
(1<<11))
f$,12,1)="H"
f$,13,9)=
9,"x")
(flags%
(1<<21))
f$,22,1)="S"
(flags%
(1<<22))
f$,23,1)="F"
tbar%
f$,3,1)="x"
f$,6,1)="x"
f$,8,1)="x"
f$,11,1)="x"
#handle%," Flags "+f$
t%=(flags%
1)<>0
s%=(flags%
1<<1)<>0
i%=(flags%
1<<8)<>0
%
#handle%," Text ";
,
#handle%," Sprite ";
'
#handle%,"'"+$(data%!0)+"'"
(data%!4 > 0)
;
#handle%," Validation "+"'"+$(data%!4)+"'"
1
#handle%," Max. length "+
(data%!8)
#
#handle%,"'"+$data%+"'"
tbar%=0
H
#handle%," Button type "+$(IcButton%+20*((flags%>>12)
15))
9
#handle%," ESG "+
((flags%>>16)
(flags%
(1<<6))
5
font_getinfo((flags%>>24)
255,fn$,fx%,fy%)
.
#handle%," Font "+fn$+", ";
*
#handle%,
(fx%)+"x"+
(fy%)+" pt"
tbar%=0
;
#handle%," Fg colour "+
((flags%>>24)
;
#handle%," Bg colour "+
((flags%>>28)
box2str(p%,width%)
rjustify(p%!0,width%)
rjustify(p%!4,width%)
rjustify(p%!8,width%)
rjustify(p%!12,width%)
2s$+=" ("+
(p%!8-p%!0)+"x"+
(p%!12-p%!4)+")"
rjustify(x%,width%)
(s$)<width%
width%-
(s$)," ")+s$
*** procs for exporting icon names ***
export_settype(type%)
ExportType%=type%
type%
0 : $(ExportFileIcon%)="file_ffb"
1,2 : $(ExportFileIcon%)="file_fff"
seticonstate0(ExportW%,2,0,0)
selecticon(ExportW%,3+type%,1)
export_savenames(fname$)
handle%,no%,line%
fname$,".")=0)
(fname$<>"<Wimp$Scrap>")
complain(
msg_lookup0("ISLF"))
"Hourglass_On"
line%=1
handle%=
fname$
#handle% :
error(0) :
ExportType%
J
export_basicline(handle%,
(&DD)+" "+
(&F2)+"iconnumbers",line%)
)
#handle%,"/* icon numbers */"
&
#handle%,"# icon numbers"
line%+=1
no%=0
NrTemplates%-1
-
export_savenames0(handle%,no%,line%)
ExportType%
1
export_basicline(handle%,
(&E1),line%)
#handle%,13
#handle%,&FF
%
"OS_File",18,fname$,&FFB
%
"OS_File",18,fname$,&FFF
#handle%
"Hourglass_Off"
export_savenames0(handle%,no%,
line%)
tname$,nricons%,i%,n$
tname$=$(TemplNames%+28*no%)
"WinBlk%!0=TemplHandle%!(4*no%)
"Wimp_GetWindowInfo",,WinBlk%
nricons%=WinBlk%!88
nricons%>0
i%=0
nricons%-1
ib%=WinBlk%+92+i%*32
1
((ib%!16
&101)=&101)
(ib%!24<>-1)
2 n$=
validationcommand($(ib%!24),"N"),2)
(n$)>0
ExportType%
R
export_basicline(handle%,
locase(tname$+"_"+n$)+"%="+
(i%),line%)
> n$="#define "+
upcase(tname$+"_"+n$)+" "+
#handle%,n$
3 n$=
upcase(tname$+"_"+n$)+":"+
#handle%,n$
line%+=1
export_basicline(handle%,l$,lineno%)
#handle%,13
#handle%,lineno%>>8
#handle%,lineno%
#handle%,
(l$)+4
#handle%,l$;